opening doc, xls, html, etc from my programm 
Author Message
 opening doc, xls, html, etc from my programm

hi -

how can i open all the files witch the application for is installed on the
maschine?

i tried for example:

Shell "Winword.exe " & openFile, vbNormalFocus

the problem is - the programm does not know where windowrd.exe is -

do i have to search for it?
do i have to place such a line for every application i like to access?

OR - is there a way to copy the possibilities of the Windows Explorer?

thank you very much



Sun, 14 Dec 2003 23:13:30 GMT  
 opening doc, xls, html, etc from my programm
Copy and paste the following code into your program (the Declare statement is all on one line):

Private 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
Private Const SW_SHOWDEFAULT = 10

Public Sub OpenFile(ByVal strFileName As String)
    ShellExecute 0, "open", strFileName, vbNull, vbNull, SW_SHOWDEFAULT
End Sub

You can use the OpenFile sub to open a document, same as double-clicking on a file in Explorer.  If you want to perform another action, such as print, you can use the name of the action, as it appears in Explorer when right-clicking (lower case), instead of "open".

You can also replace the first argument, 0, with the hWnd of a window.  This will cause any error messages which popup to be attached to that window.

Quote:

> hi -

> how can i open all the files witch the application for is installed on the
> maschine?

> i tried for example:

> Shell "Winword.exe " & openFile, vbNormalFocus

> the problem is - the programm does not know where windowrd.exe is -

> do i have to search for it?
> do i have to place such a line for every application i like to access?

> OR - is there a way to copy the possibilities of the Windows Explorer?

> thank you very much



Mon, 15 Dec 2003 19:12:39 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Excel open .doc or word open .xls?

2. Converting Doc & XLS Files to HTML

3. how to open *.asp(code part)/*.doc or any other file in its original programm

4. Accessing XLS, CSV, and tab-delimited files, etc etc using ADO

5. Auto close open doc when opening another doc

6. using word to open an html file and save it as .doc

7. File open script within HTML doc

8. Opening a word doc in part of an html page

9. making a vb5 control open a html doc in ie3

10. Is it possible to open HTML doc and sim a click

11. making a vb5 control open a html doc in ie3

12. Downloading web files (txt, xls, etc) via a module

 

 
Powered by phpBB® Forum Software