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 Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Open a non image file from access
Greg Beben 
    
15 years ago
Richard, I'm working my way through your imaging seminar.  I see how to store filenames and paths for files in the database.  What if I want to store filenames for non-image files, and then have them open in the native app when double-clicked (as the attachment data type does)?  I know I can shell out and open the native app and pass the file name, but I don't know what the native app will be ahead of time.  The file could be an Excel spreadsheet, a Word document, or it could be an image.  Can I use whatever method Windows uses when you double click a file in Windows Explorer?  Or I suppose I could check the file extension for what program to open it with, but I would prefer having Windows figure this out since it already keeps a list of what program to use to open which file type.  Also, one user could have Word 2007 for example and another have Word 2003, which might have different paths, so specifying the correct app might be difficult.  I don't want to use the attachment data type because I have WAY too many files and they're too big.


Reply from Richard Rost:

The EASIEST way is to use the Shell command with the "cmd" command interpreter, like this:

Shell "cmd /c C:\Users\Richard\Documents\MyWordDoc.docx", vbHide

This will cause any known (registered with Windows) document types to be opened in whatever the default application is for that type. The vbHide command will hide the Command prompt window but you'll still see your app.

That's the EASIEST way to do it.

Oh, and don't forget your DOUBLE quotes if you have spaces in your path or filenames:

Shell "cmd /c ""C:\Users\Richard\My Documents\Some Other File With Spaces In The Name.xlsx""", vbHide

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access 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/22/2026 7:23:20 AM. PLT: 0s