G
Guest
In Excel 2002:
I found the code below from a Tom Ogilvy post. I want to attach a macro to
a toolbar that will open the directory of my choosing. The code errors out
on ActiveWorkbook.Save Filename:=fName. If I remove that line, the macro
will bring up the Open File dialog box, but will not actually open the file
I select.
One other question - since it will be in an Excel app, how do I limit the
Open File dialog box so that it only shows .xls files?
Public Sub OpenFile()
'Save the current folder path
ProperPath = CurDir
'Change the folder path
ChDrive "C"
ChDir "C:\My Path\My Folder"
'Display the open dialog box
fName = Application.GetOpenFilename
ActiveWorkbook.Save Filename:=fName ' << causes error "wrong number of
arguments or invalid property assignment"
'Change the default folder
ChDrive ProperPath
ChDir ProperPath
End Sub
TIA
I found the code below from a Tom Ogilvy post. I want to attach a macro to
a toolbar that will open the directory of my choosing. The code errors out
on ActiveWorkbook.Save Filename:=fName. If I remove that line, the macro
will bring up the Open File dialog box, but will not actually open the file
I select.
One other question - since it will be in an Excel app, how do I limit the
Open File dialog box so that it only shows .xls files?
Public Sub OpenFile()
'Save the current folder path
ProperPath = CurDir
'Change the folder path
ChDrive "C"
ChDir "C:\My Path\My Folder"
'Display the open dialog box
fName = Application.GetOpenFilename
ActiveWorkbook.Save Filename:=fName ' << causes error "wrong number of
arguments or invalid property assignment"
'Change the default folder
ChDrive ProperPath
ChDir ProperPath
End Sub
TIA