David Ball
Registered User.
- Local time
- Tomorrow, 02:12
- Joined
- Aug 9, 2010
- Messages
- 230
Hi,
The code below opens a PDF that I have specified in the code (Sales.pdf). How can I change the code so that I can select a document name from a list box and have the correct document open?
The form containing the listbox is called frmDocumentDetails and the listbox is List1.
CODE:
Option Explicit
Option Compare Database
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_SHOWNORMAL As Long = 1
Private Const SW_SHOWMAXIMIZED As Long = 3
Private Sub CmdOpenDoc_Click()
ShellExecute 0, "Open", "C:\Users\David.Ball\Desktop\ScannedFiles\Sales.pdf", vbNullString, "C:\", SW_SHOWNORMAL
End Sub
Thanks very much
Dave
The code below opens a PDF that I have specified in the code (Sales.pdf). How can I change the code so that I can select a document name from a list box and have the correct document open?
The form containing the listbox is called frmDocumentDetails and the listbox is List1.
CODE:
Option Explicit
Option Compare Database
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_SHOWNORMAL As Long = 1
Private Const SW_SHOWMAXIMIZED As Long = 3
Private Sub CmdOpenDoc_Click()
ShellExecute 0, "Open", "C:\Users\David.Ball\Desktop\ScannedFiles\Sales.pdf", vbNullString, "C:\", SW_SHOWNORMAL
End Sub
Thanks very much
Dave