|
-
Apr 3rd, 2005, 09:35 PM
#1
Thread Starter
Fanatic Member
the "Open" dialog default path...
I want to have the application.showOpenDialog (or similar) in excel to start in a predetermined folder. I'm having trouble because:
1 - The only method I found was to change the actual default path, which would not be a plus for a program
2 - Method 1 doesn't work (and I won't use it anyways), I recorded a macro of changing the filepath but apparently if I set it using code it doesn't "get through" to excel (maybe events were off?).
Does anyone know how to have it open where I want it to?
Don't pay attention to this signature, it's contradictory.
-
Apr 3rd, 2005, 11:36 PM
#2
Re: the "Open" dialog default path...
You could just save the default path and then change it to where you need just before calling it. Then after
the file has been selected you can chage it back.
VB Code:
Dim sDefPath As String
'...
sDefPath = Application.DefaultFilePath
Application.GetOpenFilename("Text Files (*.txt), *.txt")
'Do your open stuff.
'...
'Set the path back.
Application.DefaultFilePath = sDefPath
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|