Hi All
I have been searching the web to no avail for a solution. Have also posted on ExcelForum with no results. Perhaps someone on this forum can help me solve my problem.
I have the below code which works perfectly on my PC...Running windows 7 - Excel 2007. When I try to run on another PC - also Excel 2007 - On Windows XP platform though, taking the new Path into account I get a Error - Runtime error 5 Invalid procedure or call argument. The code it stops at within below code is:
I have been searching the web to no avail for a solution. Have also posted on ExcelForum with no results. Perhaps someone on this forum can help me solve my problem.
I have the below code which works perfectly on my PC...Running windows 7 - Excel 2007. When I try to run on another PC - also Excel 2007 - On Windows XP platform though, taking the new Path into account I get a Error - Runtime error 5 Invalid procedure or call argument. The code it stops at within below code is:
Code:
ws.ExportAsFixedFormat 0, fNAME
Code:
Private Sub CommandButton9_Click()
Dim FolderPath As String, ws As Worksheet
Dim fNAME As String, WbName As String
Application.DisplayAlerts = False
Application.ScreenUpdating = False
WbName = ActiveSheet.Range("D5") & " " & ActiveSheet.Range("E5")
FolderPath = "C:\Documents and Settings\La Belle Motors\Desktop\PAYSLIPS\" & ActiveSheet.Range("g6")
On Error Resume Next
MkDir FolderPath
MkDir FolderPath & "\" & WbName
On Error GoTo 0
For Each ws In ActiveWorkbook.Worksheets
If ws.Name <> Sheet1.Name And ws.Name <> Sheet3.Name Then
fNAME = FolderPath & "\" & WbName & "\" & ws.Name & ".pdf"
ws.ExportAsFixedFormat 0, fNAME
End If
Next ws
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub