Okay so I have an Excel database that uses a form to lookup values in a table and based on the value gets a file path.
The issue is that the files were originally all .doc files. I used the following code to open them:
VB Code:
Public Function OpenFile(strfile As String) Dim x As Variant 'call word to the program 'C:\WINDOWS\SYSTEM32\WINWORD.exe x = Shell("WINWORD.exe " & strfile, 1) End FunctionVB Code:
Private Sub OpenButton_Click() 'set the sheet Set Sheet = ActiveWorkbook.Worksheets("DCA_Data") Dim strfile As String If listi = 0 Then 'error if nothing is selected response = MsgBox("No Value Selected", 0, "No Values") Else 'call the path strfile = Sheet.Cells(listi, 4) 'open the path OpenFile (strfile) End If End Sub
It is now required that I open the files as PDFs. I have converted all of the files and have updated the tables. I need to modify this code so that it opens the PDF using the computer's default application. This file will be on a server so many different computers have access to it. This means that different versions and programs may be being used. Any help would be much appreciated. Thanks.




Reply With Quote