You can use the code at http://www.cpearson.com/Excel/SpecialFolders.aspx to
get the name of the current user's My Document folder (actual name and
location varies by locale and operating system version). One you have that,
you can use ChDrive and ChDir to set the default directory to that folder
and then call GetOpenFileName.
Dim MyDocsFolderName As String
Dim SaveDir As String
Dim FName As Variant
--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC www.cpearson.com
(email on web site)
Thank you Dave. One thing. I put a button on the formatting bar that runs a
macro in a file that only holds macros. At the end of this marco I have a
command to close the macro file w/o saving. But, if I hit the Cancel button
on the Open File Dialog box the macro command to close the macro file is not
processes. How do I still close the macro file even if the Cancel button is
clicked on the Open File Dialog box.
'do what you want--open the file???
set wkbk = workbooks.open(filename:=myfilename)
End Sub
needs to be replaced with:
If myFileName = False Then
'do nothing
else
'do what you want--open the file???
set wkbk = workbooks.open(filename:=myfilename)
end if
thisworkbook.close savechanges:=false
End Sub
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.