Launch file and associated program
How do I launch a file in its associated program? The Shell statement unfortunately only supports launching an EXE file directly. If you want to be able to launch, i.e. Microsoft Word by calling a .DOC file only, you can make your VB application launch the associated program with the document using the following method:
AI
Riepilogo AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Codice sorgente
Function StartDoc(DocName As String) As Long
Dim Scr_hDC As Long
Scr_hDC = GetDesktopWindow()
StartDoc = ShellExecute(Scr_hDC, "Open", DocName, "", "C:\", SW_SHOWNORMAL)
End Function
Private Sub Form_Click()
Dim r As Long
r = StartDoc("c:\my documents\word\myletter.doc")
Debug.Print "Return code from Startdoc: "; r
End Sub
Upload
Commenti originali (3)
Recuperato da Wayback Machine