I am trying to get the GetOpenFileName function to open in a specific network path (UDI path, I've heard it called) such as OtherMachine These Files. I'm trying to assign my open dialog box to default to a. Open Dialog defaulting to specified network path. So you do get the open file dialog but the. Jul 23, 2003 Experts Exchange > Questions > Excel VBA: setting path for 'open file' dialog. Default file path to the. Of files returned from GetOpenFileName. I'm looking to set a default filename in GetOpenFilename. I'm using GetOpenFilename because it was in an example for using UNC paths (which I require) and from what I've read you cannot do that with ChDir or ChDrive using FileDialog. Is there anything that exists that will allow presetting of the filename and work with UNC paths? I've tried sticking the filename into the FileFilter section of GetOpenFilename and that does not work. Give More FeedbackFrom what I have found it looks like this may not be possible but my limited knowledge of VBA may be the issue as well. I'm stuck with using UNC because the data is located on a network and not everyone maps it to the same drive or even maps it at all. Keygen bat pm fastrak v70. In Excel if you look in Application.Dialogs() you'll find a long list of predefined dialog boxes used in Excel that you can call upon. GetOpenFilename is the same situation, because it is predefined, the customization options are minimal. To use the generic file dialog box (i.e. Not custom within Excel) you can use Application.FileDialog(msoFileDialogOpen), this will allow for further customisation including the initial filename text. Public Sub Sample() Dim Dlg As FileDialog Set Dlg = Application.FileDialog(msoFileDialogOpen) Dlg.InitialFileName = 'Sample' Dlg.Show Set Dlg = Nothing End Sub. I have googled and found answers to part of my question but not the complete question. I want to use Application.GetOpenFilename in Excel VBA to open a file and I want it to open in the same directory as ThisWorkbook.Path. I have found that beforehand I can do OpenPath = ThisWorkbook.Path ChDrive OpenPath ChDir OpenPath But, after that runs, if I run any other Application.GetOpenFilename it will still access that same directory (until perhaps I close Excel???). But, I want it to revert back to the default directory (no matter what that was). On my computer, which is Windows XP, it happens to be MyDocuments. But, some of the people using this may have XP and some may have Windows 7. I can't find anywhere how to figure out what the original default directory was so that I can store this so that I can later reset back to the default.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |