August 23rd, 2013, 03:08 PM
Invalid Procedure Call or Argument
I have just copied an EXCEL spreadsheet M/S 2007 - from a W7 to a W8 environment and get the error "Invalid Procedure Call or Argument"
The code that seems to be failing is
On Error GoTo err
The code immediately preceeding this is
' PART1 - Create a PDF file of the active worksheet
Dim OlApp As Object
Dim NewMail As Object
Dim TempFilePath As String
Dim TempFileName As String
Dim FileFullPath As String
.ScreenUpdating = False
.EnableEvents = False
' Temporary file path where pdf
' file will be saved before
' sending it in email by attaching it.
'TempFilePath = Environ$("C:\Invoices") & "\"
TempFilePath = Environ$("temp") & "\"
' Now append a date and time stamp
' in your pdf file name. Naming convention
' can be changed based on your requirement.
TempFileName = ActiveSheet.Name & "-" & Format(Now, "dd-mmm-yy h-mm-ss") & ".pdf" '
'TempFileName = ActiveSheet.Name & "-" & Format(Now, "dd-mmm-yy h-mm-ss") & ".pdf"
'TempFileName = ActiveSheet.Name & ".pdf"
'Complete path of the file where it is saved
FileFullPath = TempFilePath & TempFileName
'Now Export the Activesshet as PDF with the given File Name and path
Any ideas please
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.