Here's what I got, it runs on the machine with Access installed how ever on the runtime it seems to fail executing the shell command
Machine 0, Windows 10 Pro Access installed 64 bit executes successful
Machine 1 Windows Pro, Runtime 2016 64 bit fails to execute
Machine 2 Windows 10 Pro, Runtime 2016 64 bit fails to execute
all machine run the same version of imagemagick
Code:
Public Function PDFtoBMP(strPart_ID As String)
Dim ImageMagicPath As String
Dim StrFileStorage As String
Dim strPartNumber As String
Dim strWorkDir As String
Dim strCadSuffix As String
Dim iImageQuality As Integer
Dim strImageFormat As String
strWorkDir = DLookup("Set_Value", "Settings", "Description = 'Temp_Work_Dir'")
strPartNumber = DLookup("Part_Number", "Part_Number_tbl", "Part_ID =" & strPart_ID)
StrFileStorage = DLookup("Image_File_Location", "Customer_Tbl", "Customer_ID =" & DLookup("Customer", "Part_Number_tbl", "Part_Id =" & strPart_ID))
ImageMagicPath = DLookup("Set_Value", "Settings", "Description = 'Image_Magic_Exe'")
iImageQuality = DLookup("Set_Value", "Settings", "Description = 'BMP_Quality'")
strCadSuffix = DLookup("Cad_Suffix", "Customer_Tbl", "Customer_ID =" & DLookup("Customer", "Part_Number_tbl", "Part_Id =" & strPart_ID))
Do
If FileExists(strWorkDir & strPartNumber & strCadSuffix & ".pdf") = True Then
Exit Do
End If
DoEvents
Loop
Shell (ImageMagicPath & "magick.exe " & strWorkDir & strPartNumber & ".pdf " & " -resize " & iImageQuality & "% " & strWorkDir & strPartNumber & strCadSuffix & ".bmp") 'fails to run in runtime
' this is what a debug print of the shell string looks like C:\Program Files\ImageMagick-7.0.8-Q16\magick.exe C:\Work_dir\5-15000.pdf -resize 30% C:\Work_dir\5-15000.bmp
Do
If FileExists(strWorkDir & strPartNumber & strCadSuffix & ".bmp") = True Or FileExists(strWorkDir & strPartNumber & strCadSuffix & "-0.bmp") = True Then
Exit Do
End If
DoEvents
Pause (1)
Loop
If FileExists(StrFileStorage & strPartNumber & strCadSuffix & ".bmp") = True Then
SetAttr StrFileStorage & strPartNumber & strCadSuffix & ".bmp", vbNormal
Kill StrFileStorage & strPartNumber & strCadSuffix & ".bmp"
End If
If FileExists(strWorkDir & strPartNumber & strCadSuffix & ".bmp") = True Then
FileCopy strWorkDir & strPartNumber & strCadSuffix & ".bmp", StrFileStorage & strPartNumber & strCadSuffix & ".bmp"
Exit Function
End If
If FileExists(strWorkDir & strPartNumber & strCadSuffix & "-0.bmp") = True Then
FileCopy strWorkDir & strPartNumber & strCadSuffix & "-0.bmp", StrFileStorage & strPartNumber & strCadSuffix & ".bmp"
Exit Function
End If
End Function