M
Mia
Hello,
I´m trying to make a looping code when I´m makin a pdf-file.
I can´t get i ringt, do anyone know whats wrong with my code bellow?
I´l be so grateful!
BR
Mia
Sub Skrivabevis2009pdf()
'
' Skriv Makro
' Makrot inspelat 2009-04-21 av Mia
Dim Start As Integer
Dim Stopp As Integer
Dim SkrivUt As String
Sheets("Uppföljning").Select
Start = Range("C7").Value
Stopp = Range("C8").Value
For i = Start To Stopp
Sheets("Kunddata").Select
Range("D9").Value = i
SkrivUt = Range("G9").Value
If SkrivUt = "S" Then
Dim Prewiev As String
Dim FilenameStr As String
If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE" _
& Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") <> "" Then
FilenameStr = "M:\mo\S\bevis\" & _
ActiveSheet.Range("B10").Value & " " & Format(Now, "yyyy-mm-dd") &
".pdf"
Prewiev = "False"
Sheets("Uppföljning").Select
Sheets("Årsförnyelse 2009").Select
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=FilenameStr, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=Prewiev
Sheets("Uppföljning").Select
End If
Next
Sheets("Uppföljning").Select
End Sub
I´m trying to make a looping code when I´m makin a pdf-file.
I can´t get i ringt, do anyone know whats wrong with my code bellow?
I´l be so grateful!
BR
Mia
Sub Skrivabevis2009pdf()
'
' Skriv Makro
' Makrot inspelat 2009-04-21 av Mia
Dim Start As Integer
Dim Stopp As Integer
Dim SkrivUt As String
Sheets("Uppföljning").Select
Start = Range("C7").Value
Stopp = Range("C8").Value
For i = Start To Stopp
Sheets("Kunddata").Select
Range("D9").Value = i
SkrivUt = Range("G9").Value
If SkrivUt = "S" Then
Dim Prewiev As String
Dim FilenameStr As String
If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE" _
& Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") <> "" Then
FilenameStr = "M:\mo\S\bevis\" & _
ActiveSheet.Range("B10").Value & " " & Format(Now, "yyyy-mm-dd") &
".pdf"
Prewiev = "False"
Sheets("Uppföljning").Select
Sheets("Årsförnyelse 2009").Select
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=FilenameStr, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=Prewiev
Sheets("Uppföljning").Select
End If
Next
Sheets("Uppföljning").Select
End Sub