goedemiddag,
Ik werk op een macbook en heb online een excel format gedownload voor de boekhouding van mijn startende onderneming. Het is een goed format maar hij loopt vast wanneer ik de knop " opslaan als" gebruik.
Het format werkt wel prima op een microsoft pc. Waarschijnlijk moet de macro opslaan in mac net even anders maar ik ben daar zelf nit goed in. Kan iemand misschien zien wat ik moet wijzigen in onderstaande code om het goed te krijgen?
Alvast erg bedankt.
Anja
Sub KnopOpslaan()
On Error GoTo 0
Dim FolderPath As String
FolderPath = Application.ActiveWorkbook.path
If Right(FolderPath, 1) <> "\" Then
FolderPath = FolderPath & "\"
End If
Dim jaar As Integer
jaar = Sheets("BasisInstellingen").Range("C5").Value
FolderPath = FolderPath & "Facturen" & jaar
If Dir(FolderPath, vbDirectory) = vbNullString Then
MkDir FolderPath
End If
i = 1
If isEmpty(Range("C13")) Then
pdfname = "Factuur"
Else
pdfname = "Factuur " & Range("C13")
End If
If Dir(FolderPath & "\" & pdfname & ".pdf") <> "" Then
Do While Dir(FolderPath & "\" & pdfname & ".pdf") <> ""
If isEmpty(Range("C13")) Then
pdfname = "Factuur " & " (" & i & ")"
Else
pdfname = "Factuur " & Range("C13") & " (" & i & ")"
End If
i = i + 1
If i = 100 Then
Exit Do
End If
Loop
End If
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(0.1)
.RightMargin = Application.InchesToPoints(0.1)
.TopMargin = Application.InchesToPoints(0.3)
.BottomMargin = Application.InchesToPoints(0.1)
.HeaderMargin = Application.InchesToPoints(0.1)
.FooterMargin = Application.InchesToPoints(0.1)
.CenterHorizontally = True
.CenterVertically = False
End With
ActiveSheet.Range("B1:F47").ExportAsFixedFormat Type:=xlTypePDF, Filename:=FolderPath & "\" & pdfname & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
Exit Sub
ErrHandler:
MsgBox "Er is iets mis gegaan"
Resume Next
End Sub
Ik werk op een macbook en heb online een excel format gedownload voor de boekhouding van mijn startende onderneming. Het is een goed format maar hij loopt vast wanneer ik de knop " opslaan als" gebruik.
Het format werkt wel prima op een microsoft pc. Waarschijnlijk moet de macro opslaan in mac net even anders maar ik ben daar zelf nit goed in. Kan iemand misschien zien wat ik moet wijzigen in onderstaande code om het goed te krijgen?
Alvast erg bedankt.
Anja
Sub KnopOpslaan()
On Error GoTo 0
Dim FolderPath As String
FolderPath = Application.ActiveWorkbook.path
If Right(FolderPath, 1) <> "\" Then
FolderPath = FolderPath & "\"
End If
Dim jaar As Integer
jaar = Sheets("BasisInstellingen").Range("C5").Value
FolderPath = FolderPath & "Facturen" & jaar
If Dir(FolderPath, vbDirectory) = vbNullString Then
MkDir FolderPath
End If
i = 1
If isEmpty(Range("C13")) Then
pdfname = "Factuur"
Else
pdfname = "Factuur " & Range("C13")
End If
If Dir(FolderPath & "\" & pdfname & ".pdf") <> "" Then
Do While Dir(FolderPath & "\" & pdfname & ".pdf") <> ""
If isEmpty(Range("C13")) Then
pdfname = "Factuur " & " (" & i & ")"
Else
pdfname = "Factuur " & Range("C13") & " (" & i & ")"
End If
i = i + 1
If i = 100 Then
Exit Do
End If
Loop
End If
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(0.1)
.RightMargin = Application.InchesToPoints(0.1)
.TopMargin = Application.InchesToPoints(0.3)
.BottomMargin = Application.InchesToPoints(0.1)
.HeaderMargin = Application.InchesToPoints(0.1)
.FooterMargin = Application.InchesToPoints(0.1)
.CenterHorizontally = True
.CenterVertically = False
End With
ActiveSheet.Range("B1:F47").ExportAsFixedFormat Type:=xlTypePDF, Filename:=FolderPath & "\" & pdfname & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
Exit Sub
ErrHandler:
MsgBox "Er is iets mis gegaan"
Resume Next
End Sub