Runtime Error 424 when the module was running fine before.

Chee Fong Cheng 0 Reputation points
2023-09-23T03:35:19.63+00:00
Sub Report()

Worksheets("Report").Activate
Cells(41, 14).Select

Dim baris, kira As Integer
Dim Nama, ProperPath, Namafail As String

baris = 41
kira = Cells(40, 17).Value



Do While baris < kira + 41
    
    
Nama = Cells(baris, 14).Value
    
Cells(10, 3).Value = Nama

    
'save a copy as PDF
    
Namafail = Nama & " Timetable" & ".pdf"
    
ProperPath = ActiveWorkbook.Path
    
    
                
                Range("A1:L40").Select
                
ActiveSheets.ExportAsFixedFormat Type:=xlTypePDF, FileName:=ProperPath & "/" & Namafail
   
   
baris = baris + 1

Loop

NotifyFileSave = MsgBox(counter & " Files saved", vbOKOnly, "File Saved")
End Sub


Why do I keep getting Error 424 with this?

Developer technologies .NET .NET Runtime
Microsoft 365 and Office Development Other
Microsoft 365 and Office Excel For business Windows
{count} votes

2 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Chee Fong Cheng 0 Reputation points
    2023-09-24T05:57:45.9166667+00:00

    I solved the issue by replacing ProperPath=ActiveWorkbook.Path with a hardcoded pathname. i.e.

    ProperPath="/Users/Desktop/..."

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.