I'd like to open a PDF file using an Excel VBA macro.
I have a list of names in the excel file. As soon as the commandbutton "Open PDF" is pressed i would like the macro to open a pdf file from a certain location.
filename corrosponds with activecell.value
thanks in advance
Sub Knop1_Klikken()
Dim a As String
Dim myShell As Object
a = ActiveCell.Value
Set myShell = CreateObject("WScript.Shell")
myShell.Run "Z:\simbeton - Solidworks\bp - betonplaten\bp07 - simvlak ZH Sport\PDF\" & "a" & ".pdf"
End Sub
The error: (my MS is in dutch):
Fout -2147024894 (80070002) tijden uitvoering: Methode Run van object IWshSHell3 is mislukt
Translated: Error -2147024894 (80070002) during execution: Methode Run of object IWshSHell3 has failed.