- Private Sub FilePath_Click()
-
Rem Me![AutoNumber]
-
Dim stAppName As String
-
Dim stlink As String
-
stlink = Me![FilePath]
-
stAppName = "C:\Program Files\Internet Explorer\IEXPLORE.EXE H:\Application\Cables\" + stlink
-
Call Shell(stAppName, 1)
-
End Sub
After using the Common Dialog API to store a file name in a field "FilePath," I use the code above to click on FilePath to open the file associated with the file path. The stAppName above previously had a reference to Adobe Acrobat PDF, but some of my files are .htm files so I switched it to Internet Explorer (as shown above).
Problem: Not all of my files will be .htm extensions. Some may be .jpg, .bmp, .doc.... How can I force each file to open using its default program? I've tried deleting "C:\Program Files\Internet Explorer\IEXPLORE.EXE" and leaving the rest, but it doesn't work. The Call Shell code is clearly looking for an application to run.
Thanks in advance.
3 8122
Use FollowHyperlink instead of call shell.
Use FollowHyperlink instead of call shell.
Again, thanks for the help, Rabbit. This is the code I used ultimately: - Private Sub FilePath_Click()
-
Rem Me![AutoNumber]
-
Dim stlink As String
-
stlink = Me![FilePath]
-
FollowHyperlink stlink, , true
-
End Sub
I have a couple related problems that I've posted in their separate threads. I've searched on-line and tried changing the VB (unwittingly--my knowledge of VB is next to zero) to no avail. Those related problems are here: Display File Title, Link Using File Path http://www.thescripts.com/forum/show...94#post2984894 Follow Hyperlink, Then Set Focus to Linked App http://www.thescripts.com/forum/show...12#post2984912
For anyone interested and/or knowledgeable, any additional help would be great.
- Private Sub FilePath_Click()
-
Rem Me![AutoNumber]
-
Dim stAppName As String
-
Dim stlink As String
-
stlink = Me![FilePath]
-
stAppName = "C:\Program Files\Internet Explorer\IEXPLORE.EXE H:\Application\Cables\" + stlink
-
Call Shell(stAppName, 1)
-
End Sub
After using the Common Dialog API to store a file name in a field "FilePath," I use the code above to click on FilePath to open the file associated with the file path. The stAppName above previously had a reference to Adobe Acrobat PDF, but some of my files are .htm files so I switched it to Internet Explorer (as shown above).
Problem: Not all of my files will be .htm extensions. Some may be .jpg, .bmp, .doc.... How can I force each file to open using its default program? I've tried deleting "C:\Program Files\Internet Explorer\IEXPLORE.EXE" and leaving the rest, but it doesn't work. The Call Shell code is clearly looking for an application to run.
Thanks in advance.
You can use the ShellExecute() API Function to Open any File in its server Application and make it the Active App. If you are interested, let me know.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Paolo |
last post by:
Friends,
I have created a form with a list box that shows all my Word files.
I have then added the following code (found on comp.databases
newsgroup) to the Open event of my form and it works...
|
by: joby mathai |
last post by:
anybody please tell me how to read a .wav file using c program.when i do with the fopen statement a null value is returned.please tell me solution.
|
by: egp |
last post by:
Hi guys,
I have a database using Ms Access 2003 connected to VB6 using ADODB Connection and I want to know how to:
- display Ms Access report in VB using VB code then print it out
- backup and...
|
by: helloitsme |
last post by:
Hello!
I am trying to open a file that is selected by a user from the openfiledialog box, but the file does not open. Below is the part of the code that does so...
...
|
by: SelvaSA |
last post by:
Hi All,
I can able to create a excel file using POIFS plug-in from Jakarta, but i want open already created file from a selected location.
Here i am pasting my code to generate excel file.
...
|
by: Sasie7679 |
last post by:
Dear All,
We have a requirement to open any file using a specific application and showing it within a activex control.
For example, bmp file can be shown in Internet explorer, paint brush, photo...
|
by: andrei.avk |
last post by:
Hi, I searched for this on google and in this group, but my awesome
google-fu powers failed me. Is there a way to open any file using
default program that'd open it? In other words, to do the same...
|
by: arivusudar.nc |
last post by:
I have to open word document in web page using php coding in linux
server..
already i worte in windows supporting php code. but it is not working
in my linux server so, i need how to open word...
|
by: sanchit007 |
last post by:
How can i open any file using voice command. Means that i say anything like open internet it perform a task....... How we can do through java programming
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |