Open any file from VBA

Posted on 2012-08-10
Medium Priority
Last Modified: 2012-08-11
I have a scanned documents folder that can contain for a customer Word files, pdfs, Excel, text files.  These appear is a listbox  on an Access 2003 from - however, if the user wants to view the file, is there a universal open command that will open the file without having to create an application object?  Right now, there is a ShellEx module that uses ShellExecute and ShellExecuteForExplore apis, but it does not work.

Question by:ssmith94015
LVL 61

Accepted Solution

mbizup earned 2000 total points
ID: 38281262
Application.FollowHyperlink lstListbox

Open in new window

(Place that in the listbox's double click event)

Author Closing Comment

ID: 38281275
This is so MUCH simpler!  It worked on all the file types, thank you.


Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question