Ravindra Bagale · Excelसर्व coursesया course चे lessonsशोधाEnglish

Excel · मराठी आवृत्ती

15.6 Stage 5 — Refresh आणि PDF macro

रवींद्र बागले यांच्या course वर आधारित · सहज मराठीत explanation

या page मध्ये

हा source macro refresh request करून Dashboard PDF export करतो. Platform/connectorनुसार async refreshचा behavior तपासल्याशिवाय याला सर्व data पूर्णपणे fresh असल्याची guarantee समजू नका.

Setup

  1. Practice workbook .xlsm म्हणून local writable folderमध्ये save करा.
  2. Developer › Visual Basic › Insert Moduleमध्ये code ठेवा.
  3. Dashboardवर “Refresh & Export PDF” shapeला RefreshAndExport assign करा.
  4. Print Area/page setup तयार करा; intended slicer selection स्पष्ट ठेवा.
Sub RefreshAndExport()
    Dim pdfPath As String

    On Error GoTo ErrHandler
    ThisWorkbook.RefreshAll
    Application.CalculateUntilAsyncQueriesDone

    pdfPath = ThisWorkbook.Path & Application.PathSeparator & _
              "Blinkit_Dashboard_" & Format(Date, "dd-mm-yyyy") & ".pdf"

    ThisWorkbook.Worksheets("Dashboard").ExportAsFixedFormat _
        Type:=xlTypePDF, Filename:=pdfPath, Quality:=xlQualityStandard, _
        OpenAfterPublish:=True

    MsgBox "Dashboard refreshed and saved as:" & vbCrLf & pdfPath, vbInformation
    Exit Sub

ErrHandler:
    MsgBox "Could not finish: " & Err.Description, vbExclamation
End Sub

वापरण्याआधी सुधारणा

Source example30September2026ला Blinkit_Dashboard_30-09-2026.pdf बनवतो. हा template filename आहे; report period आणि export date वेगळे असू शकतात.

Practice

काल्पनिक dataवर macro तपासा. _AllCities नाव तेव्हाच जोडा जेव्हा City filter खरोखर All आहे. PDF उघडून period, filters, totals आणि page count तपासा.