Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening files from VBA 1

Status
Not open for further replies.

addy

Technical User
May 18, 2001
743
GB
I am trying to use the method of opening files from within VBA as per this FAQ:


However, whilst it is working perfectly in Windows 2000 it does not work in Windows XP. When I click the button to execute the code absolutely nothing happens. When I step through the code, it is going through the code line by line but then it doesn't open a file.

Any ideas how to get it working with Win XP?

Thanks.
 
Hi!

Why not just set the Hyperlink property of the button to the path of the file? Then the button click will open the file.

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
addy,

Had similar problems with the same FAQ. Try:

Private Sub cmdTemporaryBadge_Click()

Dim strFileName As String
Dim A As Long

strFileName = "your file path"
A = Shell("RUNDLL32.EXE URL.DLL,FileProtocolHandler " & strFileName, vbMaximizedFocus)

End Sub

This came from a 2002 Tek Tip FAQ I dug up and seems to work for all extensions.

Good Luck
 
Thanks Coldham - seems to work.

jebry - I tried your idea which kind of worked but I kept getting a message asking me if I wanted to open the file, with a warning about viruses.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top