HI All,
I am going in circles on this one. I have several versions of this running on other systems with no problem. It opens a PDF it it exists from PO Receipt History inquiry. It is on Sage 100 2016 Advanced. It is running on Server 2012 R2. It is a button script & is passed the Receipt no. Variable. It is set to run on the server. The company is set for external access (they have other scripts that work just fine) The client saves the vendor packing slips using the receipt no. to the folder specified.
The issue is that if the file exists, nothing happens. It doesn't lock up. If the file doesn't exist, I get the msgbox that it doesn't exist. I have tested pasting the strfilepath into the run box in Sage and it opens the pdf. I am baffled. I have tried a number versions based on reading vb sites but nothing works.
Dim sh
Dim strFilePath
sRecNo = PO_ReceiptHistory_bus_ReceiptNo
strFilePath ="\\acctsage\DocScan\PackList\" &sRecNo& ".pdf"
Set sh = CreateObject("Wscript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(strFilePath) Then
Set sh = CreateObject("Wscript.Shell")
sh.Run strFilePath
Set sh = Nothing
Else
sMsg = "file "& sRecNo &".pdf not found!"
retMsg = oSession.AsObject(oSession.UI).MessageBox(sMsg)
End If
Set fso = Nothing
Bob Osborn