Hi to everybody,
How to open the files otherthan .exe by using VB
can any body tell with example please
Thank u
3 7305 Stwange 126
Recognized Expert New Member
In your declarations at the top of the code, paste: - Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
And then use this function: - Public Function ShellExec(ByVal strFile As String)
-
Dim x As Long: x = ShellExecute(0, "OPEN", strFile, "", "", 0)
-
End Function
Passing the filepath as a parameter.
Hope that helps.
Stwange 126
Recognized Expert New Member
And the example you requested:
Private Sub cmdOpen_Click()
ShellExec("C:\testfile.doc")
End Sub
In your declarations at the top of the code, paste: - Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
And then use this function: - Public Function ShellExec(ByVal strFile As String)
-
Dim x As Long: x = ShellExecute(0, "OPEN", strFile, "", "", 0)
-
End Function
Passing the filepath as a parameter.
Hope that helps.
Woa, that's very nice. Sometimes I would be called Shell excute function, but Shell command in VB can't archive parameters with space character.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: John Bowling |
last post by:
I'm creating a routine (not in a browser) to move multiple files on a daily
basis to a backup directory. It can be done easily by call shell functions
like 'mv file* newdir'.
I can't find any...
|
by: Siemel Naran |
last post by:
Hi. I'm writing a command shell that reads commands from standard input.
At this point I have the command in a std::string. Now I want to execute
this command in the shell. From the Borland...
|
by: Lauren Wilson |
last post by:
Hi folks,
In an A2K app, I have attempted to use the following command in some
VBA code with IDENTICAL results with every single version of the
following:
Shell "outlook.exe", vbHide
Shell...
|
by: Mike |
last post by:
Am trying to open a Microsoft Word .doc file using Access 2000 with
Shell function (on Windows XP Operating system)
Here is the code :
Shell "C:\Program Files\Microsoft...
|
by: bearophileHUGS |
last post by:
For array.array "B" means unsigned char, and such arrays accept to be
initialized from (str) strings too, this is quite useful:
But it seems such capability isn't shared with the append:
...
|
by: George Sakkis |
last post by:
I'm trying to figure out why Popen captures the stderr of a specific
command when it runs through the shell but not without it. IOW:
cmd =
if 1: # this captures both stdout and stderr as...
|
by: Tom Gur |
last post by:
Hi,
It's seems that csh and tcsh acts a bit different when handling
special characters in quotes.
i.e: if i'll supply my program with the following arguments: -winpath
"c:\\temp\\"
tcsh will...
|
by: dennijr |
last post by:
ok, shell always used to be easy for me, now its starting to get annoying cause i dont know wats wrong
heres the simplist code possible:
Private Sub IExplorer_Click()
a = Shell("C:\Program...
|
by: mmm |
last post by:
I am looking for advice on Python Editors and IDEs
I have read other posts and threads on the subject and my two
questions at this time are mainly about the IDLE-like F5-run
facilities. While I...
|
by: Samuel A. Falvo II |
last post by:
I have a shell script script.sh that launches a Java process in the
background using the &-operator, like so:
#!/bin/bash
java ... arguments here ... &
In my Python code, I want to invoke...
|
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,...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |