macro opslaan loopt vast op mac

Pagina: 1
Acties:

Vraag


Acties:
  • 0 Henk 'm!

  • anja78
  • Registratie: Februari 2018
  • Laatst online: 29-01 14:14
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

Alle reacties


Acties:
  • 0 Henk 'm!

  • MAX3400
  • Registratie: Mei 2003
  • Laatst online: 27-09 22:07

MAX3400

XBL: OctagonQontrol

De VBA-editor heeft ook een debug-mode; ongetwijfeld komen daar fouten uit die je zelf kan aanwijzen en mogelijk corrigeren?

Sowieso zijn de path-variabelen/syntax niet volledig correct, lijkt me zo. Een Apple "kan niet overweg" met \

Random spul van internet downloaden lijkt me niet altijd een briljant idee; het zou dan ook handig zijn om je vraag ook te stellen aan degene die het initieel gemaakt heeft

[ Voor 28% gewijzigd door MAX3400 op 03-02-2018 12:33 ]

Mijn advertenties!!! | Mijn antwoorden zijn vaak niet snowflake-proof