Excel, VBA

각각의 sheet를 sheet 이름으로 한 pdf 생성

Jack Moon 2013. 10. 30. 16:39

Sub PdfCreate()

    Dim ws As Worksheet

    Dim Fname As String

    For Each ws In ActiveWorkbook.Worksheets

        on Error Resume Next 'Continue if an error results


        ' Name generated PDF files based on the worksheet Index (i.e. 1,2,3, etc.)

        ' Fname = "Annex 1.1." & ws.Index & "_result"


        ' Another option is to use the worksheet name. This may cause errors if the worksheet

        ' name contains characters that are not allowed in file names.

        Fname = ws.Name


        ws.ExportAsFixedFormat _

            Type:=xlTypePDF, _

            Filename:=Fname, _

            Quality:=xlQualityStandard, _

            IncludeDocProperties:=True, _

            IgnorePrintAreas:=False

    Next ws

End Sub



pdf_create_each_sheet.vb


pdf_create_each_sheet.vb
0.0MB