0
votes

I already have a code that do the exporting to PDF, it exports the selected sheets but I want to make the exported selection in the sheets bigger in the PDF file, to help the printing phase later.

Here's the code that do the exporting:

Sub PDFActiveSheet()
    Dim wsA As Worksheet
    Dim wbA As Workbook
    Dim strTime As String
    Dim strName As String
    Dim strPath As String
    Dim strFile As String
    Dim strPathFile As String
    Dim myFile As Variant
    On Error GoTo errHandler

    Set wbA = ActiveWorkbook
    Set wsA = ActiveSheet
    strTime = Format(Now(), "yyyymmdd\_hhmm")

    strPath = wbA.Path
    If strPath = "" Then
      strPath = Application.DefaultFilePath
    End If
    strPath = strPath & "\"

    strName = Replace(wsA.Name, " ", "")
    strName = Replace(strName, ".", "_")

    strFile = strName & "_" & strTime & ".pdf"
    strPathFile = strPath & strFile

    myFile = Application.GetSaveAsFilename _
        (InitialFileName:=strPathFile, _
            FileFilter:="PDF Files (*.pdf), *.pdf", _
            Title:="Select Folder and FileName to save")

    If myFile <> "False" Then
        wsA.ExportAsFixedFormat _
            Type:=xlTypePDF, _
            Filename:=myFile, _
            Quality:=xlQualityStandard, _
            IncludeDocProperties:=True, _
            IgnorePrintAreas:=False, _
            OpenAfterPublish:=False

        MsgBox "Les QrCodes ont été exporter dans le fichier PDF" _
          & vbCrLf _
          & myFile
    End If

exitHandler:
    Exit Sub
errHandler:
    MsgBox "Erreur lors de l'exportation"
    Resume exitHandler
End Sub
1
It is unclear what you mean by "I want to make the exported selection in the sheets bigger in the PDF file" • The ExportAsFixedFormat function will always export to PDF as it is in your sheet. So if you make it bigger in your sheet, then it will probably export it bigger.Pᴇʜ
Thank you for your response, so far i can hardly make it bigger in my sheet without redoing the code, and i would prefer to keep things as they are in the sheets,Sonofliberty11
Could be a quick solution for your issue: Copy sheet, adjust size in the copy, export it, delete copy.Pᴇʜ

1 Answers

1
votes

If you simply want to zoom in by a fix %, use the following command before the export line

wsA.PageSetup.Zoom = 150