Hi all!
I'm a beginner in coding. But I managed to make a working code for windows, but when I want to convert it to Mac it gave a runtime error 429 (AvtiveX component can't create object). This is the code that gave the error:
Function FactuurOpslaan()
Dim stPath As String
With Sheets("Factuur Opstellen")
stPath = ActiveWorkbook.Path & "\Facturen\"
stPath = stPath & "Facturen" & Space(1) & MaandNaam(Month(Now)) & "-" & Year(Now)
With CreateObject("Scripting.FileSystemObject")
If Not .FolderExists(stPath) Then .CreateFolder stPath
End With
.ExportAsFixedFormat 0, stPath & "\Factuur " & .Range("F29") & ".pdf", , 1
End With
End Function
The error is in the "With CreateObject("Scripting.FileSystemObject")" part. Already from google search I found out that Scripting.FileSystemObject is only supported by windows, and will never work on a Mac. But I don't know how to fix it. Hope you can help me!
Kind regards
Bookmarks