Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Developer Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Open to a specific folder
John Valencic 
     
2 years ago
I'm using the Browser control in Access 2007 to view PDF documents. Everything works fine, but I'd like to open to a specific directory when the button for the file dialog is pressed. Currently it opens to the "Documents" folder, but I'd like it to open to the "Newsletter" folder.

Here is the code for my button:

Private Sub btnBrowse_Click()
Dim File As FileDialog
Set File = Application.FileDialog(msoFileDialogFilePicker)
File.AllowMultiSelect = False
If File.Show Then
Me.txtFileLocation = File.SelectedItems.Item(1)
Me.WebBrowser2.Object.Navigate txtFileLocation
End If
End Sub
Kevin Robertson  @Reply  
          
2 years ago
Use Richard's PickFile() function where you can specify the initial folder.

Code Vault: Pick a File with FileDialog
John Valencic OP  @Reply  
     
2 years ago
Thanks Kevin. I'll give that a try and post back
John Valencic OP  @Reply  
     
2 years ago
Thanks for the link Kevin.
OK, the dialog box now opens to the directory specified in the Function, I can select the file I want to open, but I'm unable to view it in my WebBrowser. Debug/compile doesn't show any errors

Code:
Private Sub btnBrowse_Click()
    PickFile ("E:\Fishing_Club_SSA")
End Sub
Alex Hedley  @Reply  
           
2 years ago
Is it a specific file that doesn't show or all of them?
If you hardcode the WebBrowser to the file does it load?
John Valencic OP  @Reply  
     
2 years ago
Good Morning Alex,
The file dialog opens to my specified directory, I can select the file I want to view, but it doesn't open in the web Browser extension. In my original post, that code would open the document in the Browser extension for viewing, but to get to the document I'd have to navigate through too many directories to get to the document, hence the pick file function.

Kevin Robertson  @Reply  
          
2 years ago
You had a Text Box called txtFileLocation. Add the path to the Text Box as before, then you should be able to navigate the same as before.

Private Sub btnBrowse_Click()

    txtFileLocation = PickFile ("E:\Fishing_Club_SSA")
    WebBrowser2.Object.Navigate txtFileLocation

End Sub
John Valencic OP  @Reply  
     
2 years ago
That did it Kevin. Thanks so much for your expertise
Kevin Robertson  @Reply  
          
2 years ago
You're welcome.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/9/2026 1:11:18 AM. PLT: 0s