- 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\IEXPLO RE.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 8149 Rabbit 12,516
Recognized Expert Moderator MVP
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.
ADezii 8,834
Recognized Expert Expert - 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\IEXPLO RE.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 fine:
Private Sub Form_Open(Cancel As Integer)
Dim file As String
Dim files As String
files = ""
|
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 restore Ms Access table using VB code
- open HTML file using VB code
Is there anyone can help me please? It's urgent.
Thanks before
|
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...
....................................................................
OpenFileDialog fdlg = new OpenFileDialog();
fdlg.Filter = "Text Files(*.txt)|*.txt";
fdlg.RestoreDirectory = true;
if (fdlg.ShowDialog() == DialogResult.OK)
|
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.
esponse.setContentType("application/vnd.ms-excel");
PrintWriter out = response.getWriter();
String filepath="E:/share/PAR.xls";
response.setHeader("Content-Disposition", "attachment; filename="+filepath+";");
| |
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 shop etc. The user will specify the exe
path of the application alone. If word application has to be opened, user will specify just "WINWORD.EXE" or "WORDPAD.EXE" path.
I need the newly opened application handle for showing it within an activex...
|
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 action
as double-clicking in windows explorer? And secondly, is there a way
to do the same thing for linux that'd work across all desktop
environments and distributions, or at least in all major ones? What
I'm trying to do here is to have records...
|
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 document in linux
server without COM class.
|
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: 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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |