lanuching file by extension 
Author Message
 lanuching file by extension

This is the VB code to launch a Program by shortcut

_________snip___________________________________
Option Explicit

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 Sub Command1_Click()
    Dim ret&
    ret = ShellExecute(Me.hwnd, "", _

        "c:\Windows\Start Menu\Programs\StartUp\Alarm 95.lnk", _
        "", "", 1)
End Sub
_____________________________snip_________________

I would like to launch a file (doc, rtf) just by sending "Drive\Path .
. .  \Path\filename.extension " wiht VBA in Word and Excel.

How to do this?

Gottfried



Fri, 31 Mar 2000 03:00:00 GMT  
 lanuching file by extension

Gottfried,

You can do it exactly the same way you were launching a link -
by calling ShellExecute API with a file name. This assumes that
there is a registered association for a given extension (.rtf,
for example). If Explorer of File Manager spawns an application
when you double-click on a file with the extension you are trying
to use, the association is already registered, and ShellExecute
should work.

HTH

Regards,
Max Starets


: This is the VB code to launch a Program by shortcut

: _________snip___________________________________
: Option Explicit

: 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 Sub Command1_Click()
:     Dim ret&
:     ret = ShellExecute(Me.hwnd, "", _

:         "c:\Windows\Start Menu\Programs\StartUp\Alarm 95.lnk", _
:         "", "", 1)
: End Sub
: _____________________________snip_________________

: I would like to launch a file (doc, rtf) just by sending "Drive\Path .
: . .  \Path\filename.extension " wiht VBA in Word and Excel.

: How to do this?

: Gottfried



Sat, 01 Apr 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Help Saving Publisher File As Different File Extension

2. Flat File export won't work with certain file extensions

3. Importing text files without standard text file extension

4. Sorting files by file extension

5. .pub extension versus .php extensions

6. Pas d'extension txt.../No txt extension...

7. Change extension from mdb to a custom extension

8. Major extension conflict with MS Extensions

9. importing files with DBX extensions

10. outlook file name extensions


 
Powered by phpBB® Forum Software © phpBB Group