You are on page 1of 1

Sub Button9_Click() Dim Filter As String, Title As String Dim Filename As Variant Dim Template As String ' File

filters Filter = "Excel Workbooks, *.xls; *.xlsx" ' Set Dialog Caption Title = "Select Konica Timesheet template" ' Select Start Drive & Path ChDrive ("C") ChDir ("C:\Documents and Settings") With Application ' Set File Name to selected File Filename = .GetOpenFilename(Filter, 1, Title) ' Reset Start Drive/Path ChDrive (Left(.DefaultFilePath, 1)) ChDir (.DefaultFilePath) End With 'Exit on Cancel If Filename = False Then MsgBox "Source data file not selected.", vbExclamation Exit Sub Else Range("E8").Select Selection.Locked = True ActiveCell.Value = Filename End If End Sub

You might also like