I was using Windows 7 on my pc with the following code.
Using Dropbox i have uploaded some files then on my new Windows 10 pc downloaded & installed them.
Majority working fine expect two.
This one below will not export as a pdf file.
I see a run time error 5 which is INVALID PROCEDURE CALL OR ARGUMENT
If a invoice exists in the folder i see the message box to advise me,so the path is correct as the code checked to see if one was already saved.
When it comes to saving the active sheet as a pdf it fails to do so.
Do you see an issue or please advise how i can move on and save as a word doc
I need to fix this as ive plenty to save & print
>>> use code - tags <<<
Using Dropbox i have uploaded some files then on my new Windows 10 pc downloaded & installed them.
Majority working fine expect two.
This one below will not export as a pdf file.
I see a run time error 5 which is INVALID PROCEDURE CALL OR ARGUMENT
If a invoice exists in the folder i see the message box to advise me,so the path is correct as the code checked to see if one was already saved.
When it comes to saving the active sheet as a pdf it fails to do so.
Do you see an issue or please advise how i can move on and save as a word doc
I need to fix this as ive plenty to save & print
>>> use code - tags <<<
Code:
strFileName = "C:\Users\there\Desktop\REMOTES ETC\DR\DR COPY INVOICES\" & Range("L4").Value & ".pdf"
If Dir(strFileName) <> vbNullString Then
MsgBox "INVOICE " & Range("L4").Value & " WAS NOT SAVED AS IT ALLREADY EXISTS" & vbNewLine & vbNewLine & "PLEASE CHECK FILE IN FOLDER THAT WILL NOW OPEN.", vbCritical + vbOKOnly, "INVOICE NOT SAVED MESSAGE"
VBA.Shell "explorer.exe /select, " & "" & strFileName & "", vbNormalFocus 'DUPLICATE INVOICE FOUND
Exit Sub
End If
strFileName = "C:\Users\there\Desktop\REMOTES ETC\DR\DR COPY INVOICES\" & Range("L4").Value & ".pdf"
With ActiveSheet
.ExportAsFixedFormat Type:=xlTypePDF, fileName:=strFileName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False
Last edited by a moderator: