Hello,
I have a table for Equipment, and each piece of Equipment has a unique serial number (ST011402 for example). Associated with the Equipment are Load Tests. The completed Load Test forms are scanned and stored in Sharepoint. In tbl_Load_Tests, I have a field for a hyperlink linking to each complete form in Sharpoint, and the file name is similar to ST011402_2015_12_12.pdf. Some pieces of Equipment have had 25 Load Tests performs, others have had 1.
I want to click a button on a specific Equipment page which will then print all pdfs in Sharepoint with begin with ST011402. I have a piece of code I have found online, but it isn't working exactly right. Am I close or REALLY far off?
Code:
Option Compare Database
Private Sub Command0_Click()
Dim strOnePdfFile As String
Dim strWild As String
strWild = "https://sharepoint.connect ... /Load Testing Forms/ST011402*.pdf"
strOnePdfFile = Dir(strWild)
Do While strOnePdfFile <> ""
Call PrintOnePdf(strOnePdfFile)
strOnePdfFile = Dir()
Loop
MsgBox "done printing files"
End Sub
Sub PrintOnePdf(strF As String)
CreateObject("Shell.Application").Namespace(0).ParseName(strF).InvokeVerb ("Print")
End Sub
On line "strOnePdfFile = Dir(strWild)" I am getting:
Code:
Run-Time Error '52':
Bad File Name or number
Thank you for any and all help!