Below is the code to set the initial filename. What error messages are
you getting on the other problems. show me your code.
Code:
--------------------
Private Sub Open_New_Engineer_Spec_8_Click()
Dim fd As FileDialog
'Create a FileDialog object as a File Picker dialog box.
Set fd = Application.FileDialog(msoFileDialogFilePicker)
'Declare a variable to contain the path
'of each selected item. Even though the path is a String,
'the variable must be a Variant because For Each...Next
'routines only work with Variants and Objects.
Dim vrtSelectedItem As Variant
'Use a With...End With block to reference the FileDialog object.
With fd
.AllowMultiSelect = False
'Add a filter that includes GIF and JPEG images and make it the
'second item in the list.
.Filters.Add "Excel Files (*.xlsm)", "*.xlsm", 1
'Sets the initial file filter to number 2.
.FilterIndex = 1
'Set the initial path to the C:\ drive.
.InitialFileName = "C:\temp\Master Engineering Spec*.xlsm"
'Use the Show method to display the File Picker dialog box and return
'the user's action.
'If the user presses the action button...
If .Show = -1 Then
FName = .SelectedItems.Item(1)
'If the user presses Cancel...
Else
MsgBox ("Cannot Open file - Exiting Macro")
Exit Sub
End If
End With
'Set the object variable to Nothing.
Set fd = Nothing
Set bk = Workbooks.Open(Filename:=FName)
End Sub
--------------------
--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=164934
Microsoft Office Help