15. Final Project: FreshGo Maharashtra Monthly Report
15.6 Stage 5 – A Small Macro
Export the dashboard only after checking the data and view
The regional lead may want a PDF they can read without opening the worksheet. That PDF captures one view of your synthetic FreshGo practice report. Your job is to show that the displayed values describe the approved September sample, that the period and filters are visible, and that the created file opens and reads cleanly. Write a small export routine only after you can repeat the process manually.
Start with the completed Dashboard worksheet. The baseline reports 12–16 September 2026 and all six cities. The dashboard controls should produce ₹4,699 delivered amount, ten delivered orders, AOV ₹469.90, one cancellation of 12 approved and six of eight within 12 minutes with eight of ten measured. Use another scope only when intentionally producing a separately named review view. The optional macro on this page implements the baseline handoff.
Refresh, verify and export are different operations. Confirm the intended source and selected view before creating the PDF. Then inspect the generated file itself.
Decide which part to automate
- Evidence work includes identifying the source batch, confirming review exclusions, checking the actual loaded Table and matching the selected dashboard to a source-level control.
- Display work includes choosing the intended period and filters, then reproducing and validating the output in print preview.
- Repetitive export work includes opening a save dialog, choosing a new PDF path and asking Excel to render the Dashboard worksheet with its print area.
- Review the actual file after generation. A PDF does not retain worksheet formulas, input evidence or working Excel slicers. Include enough context in the visible output.
The simplest project can export manually with Excel's PDF option or a compatible print-to-PDF feature. The optional example below is for an authorized local practice workbook in Windows desktop Excel where VBA is allowed. Excel for the web can open some macro-enabled workbooks, but it cannot create, run or edit their VBA. If settings or your environment disallow macros, use the manual route with the same evidence checks and note which route your course submission uses.
Check what a refresh actually changed
A student adds a reviewed order, clicks Refresh All and sees a recent save timestamp. The old amount still looks plausible. Several independent things could explain it: the approved order was not included, the refreshed output did not load, an old PivotTable source remains selected or a date filter hides the new transaction. A successful save confirms neither which rows are in the approved source nor which ones the dashboard includes.
Check the loaded data, then the dependent calculations
- Identify the input you intend to use. Record the original September batch and dates for the final PDF. Keep multiple trial versions separate.
- Start with the approved intake controls. The baseline original has 15 source rows, two confirmed replays and one held record. The published worksheet has 12 approved at ₹5,179.
- If you use a query source, refresh using a permitted command and inspect its actual loaded data. Check the date coverage, an expected row presence and the count and sum. A changed Query Editor preview is a separate observation.
- Review dependent PivotTables or formulas after the approved source is confirmed. Use their proper refresh or calculation controls. Check the fixed and selected report regions for what they should update.
- Reset City, Platform, Category and timeline or selector inputs to the baseline handoff state. Confirm dates 12–16 September and a visible All cities label consistent with the displayed scope.
- Check the report cards and the corresponding detail. Pune remains ₹1,610 at the default view and the daily peak remains 14 September at ₹2,789. A matched headline alone does not check every dependent part.
Understand the limitation of a generic VBA refresh
Microsoft documents a specific Power Query failure case for a query that loads data to a worksheet Table. During a workbook RefreshAll, a failed query can leave its previously loaded Table while other connections refresh. That behavior can occur without a VBA run-time error even when background refresh is disabled. Waiting for some async activity or catching a generic runtime exception is therefore insufficient evidence that every source is current. A macro that appends “refreshed and saved” to a success dialog can misstate what happened.
For the documented worksheet-loaded query scenario, Microsoft describes separately calling its Table-associated QueryTable.Refresh with BackgroundQuery:=False and handling possible errors. That is a specific error-detection method, not a general release gate for every Data Model, query, connection and source type. A correctly completed call also cannot establish that the newest expected input files were actually supplied or that the dashboard uses the intended selection. Keep the approved input and output comparisons in the workflow even if you later automate a compatible connection.
In this project the small VBA routine exports only. If the exercise uses a manual approved worksheet instead of a query, compare the controlled worksheet directly and refresh any dependent PivotTables as needed. There is no benefit in simulating a connection refresh when the authoritative data actually lives in the local Table. Make your update instructions describe the source you use.
Find the first layer that disagrees when an update looks stale
Run an experiment on paper before changing the workbook. The input owner says the ₹180 order has arrived. A check of the loaded worksheet shows 12 approved rows and ₹5,179. That is still the original population. The dashboard is expected to look stale because its input is stale. Go back to the raw ingestion and query steps; investigate the selected input, permissions and whether the new order had an approved disposition. Changing the chart filter might produce a different value and distract you from the actual fixed input.
Now imagine the loaded worksheet contains 13 approved rows and ₹5,359. Its newest approved record is BLK-9014. The regional Calc summary still has ten delivered and ₹4,699. In this case the stale result is between the loaded data and summary. Inspect the PivotTable source and whether it includes the newer table row. Refresh that summary using the supported control. If the approved data is correct and the Calc summary updates but Dashboard still displays ₹4,699, investigate the formula reference or selected scope. The two cases look identical from a distant PDF but require different repairs.
There is a third case where the ₹4,699 amount is intentional. Someone selected 12–16 September in the updated workbook, explicitly leaving the added date outside the requested window. Reproduce the selection and check the visible date label. If the PDF says 12–16 September for that copy, the figure may correctly answer the narrower request. If its title says “through 17 September,” the same number reveals a scope error. The evidence is the intended selection and the independently expected filtered amount together.
- Write the source, loaded result, Calc output, dashboard value and selected period side by side on paper. Locate the first pair that disagrees, then check the corresponding connection.
- Confirm the expected changed row and an unchanged comparison separately. Missing the change and adding an unrelated correction can produce the old total accidentally.
- Inspect error and review blanks explicitly. A hidden error note beside old data can be lost when packaging a single Dashboard sheet.
- Choose the correct next action only after locating the discrepancy. This makes repeated refresh attempts or unrelated formula edits unnecessary.
Use a changed row and an unchanged row as evidence
For the separate next-batch variation from earlier stages, BLK-9014 is a new approved Pune delivery at ₹180 on 17 September. Its presence should change approved amount from ₹5,179 to ₹5,359 and delivered amount from ₹4,699 to ₹4,879, with 11 delivered orders. Nagpur stays ₹450 and Pune rises to ₹1,790. The approved BLK-9014 evidence and the unchanged Nagpur subtotal test different paths. If the table shows the new SourceRow but the print preview shows the original period, check the time selection and final captions rather than reusing that incorrectly scoped output.
The export exercise below targets SEP-BASE, your name for the original 12-approved-row practice batch. The updated variation has a different source version. Do not change the expected controls merely to get the baseline button to act on it. A report tool meant to handle several approved inputs should read a trusted, independently maintained expected record per batch and verify each configuration. A fixed classroom baseline is easier to understand and test.
Prepare the Dashboard and Checks sheets
Make the print scope explicit
On Dashboard set an explicit print area covering the report title, selected scope, cards and detail panels. Use a supported desktop preview tool to see whether the area fits and whether the scope remains readable. A one-page setting can make labels too small after scaling; adjust the layout before relying on fit. Keep raw or directory sheets out of the output. If your workbook has a visible scope note only in a shape, link or copy an intentional verified label into a cell too. The macro reads the cell-based review evidence described below.
For the fixed classroom exercise use a visible scope cell with text All cities only when all cities are actually included. Make the date range 12–16 September 2026 visible elsewhere in the header. If you use manual scope copy, review that note each run because the note itself cannot detect a stale filter. Link to the filter state if your report already maintains an accurate formula-driven scope label, and test which selectors it tracks. Do not treat a check that reads a label as inspection of your PivotTable connections.
Set up the small confirmation range
On a worksheet named Checks, use column A for descriptions and column B for the values below. If a delivery amount is in Dashboard D7, enter a formula such as =Dashboard!D7 into Checks B4 rather than typing 4699. Use the actual value cells from your report. Repeat for the count and the visible scope text. Ensure each linked value has the expected type or text using the original workbook formulas.
| Cell | Meaning | Expected baseline |
|---|---|---|
| B2 | Input batch identifier recorded by the reviewer after source checks | SEP-BASE |
| B3 | Reviewer gate set manually after checking the actual inputs, summaries and report view | READY |
| B4 | Linked current Dashboard delivered amount | 4699 |
| B5 | Linked current Dashboard delivered order count | 10 |
| B6 | Linked current visible scope cell | All cities |
In adjacent cells keep the remaining manual checks: loaded approved count and amount, earliest and latest eligible date, reconciliation of held or replay counts, timing and cancellation definitions, and trace values for the daily and city evidence. The first five controls are a guard for this specific small export. They cannot identify every way records or filters can change. For example, two changed transactions may preserve the displayed amount and count. Add an independently verifiable source row or version check during your manual review.
Keep B3 at REVIEW while you apply changes. Set READY once the source, displayed values, active filters and preview agree for the intended release. The sample below resets READY when it reaches the run's save-dialog step, including when you later cancel that dialog. It does not save the workbook. Reopen a preserved input copy if a test changes filters or review values in an unexpected way.
Trace one export attempt
Check the baseline source and view
Confirm SEP-BASE, 12 approved, correct dates, all cities, report amount ₹4,699 and ten delivered. Inspect the print area with your practice layout.
Open the local export routine
The routine reads explicit Sheets in the workbook containing the code. It checks the recorded batch, READY state, linked amount, count, scope, and existence of a dashboard print area.
Choose a new PDF name
The save dialog asks for a new local filename. A cancellation creates no PDF. If a file with the chosen name already exists, the routine prompts you to use another name.
Open and review the result
Compare the generated PDF with the source controls. Verify title, date range, selected scope, characters, card values and page clipping before treating it as shareable.
Optional desktop route · Add a small, bounded VBA procedure
Use a copy you own in an authorized local desktop environment. Save it as an Excel Macro-Enabled Workbook with the .xlsm extension. Open the Visual Basic Editor from the Developer tab. In the project for this workbook, insert a standard module. Do not paste the code into the Personal Macro Workbook because the routine uses ThisWorkbook to target the report that contains it. Paste and inspect the procedure below. If your settings prohibit the exercise, keep the manual route and no change to those settings is necessary.
Option Explicit
Public Sub ExportVerifiedDashboard()
Dim wb As Workbook
Dim checks As Worksheet
Dim dashboard As Worksheet
Dim deliveredAmount As Variant
Dim deliveredOrders As Variant
Dim chosenPath As Variant
Dim pdfPath As String
On Error GoTo ExportFailed
Set wb = ThisWorkbook
Set checks = wb.Worksheets("Checks")
Set dashboard = wb.Worksheets("Dashboard")
If CStr(checks.Range("B2").Value2) <> "SEP-BASE" Or _
CStr(checks.Range("B3").Value2) <> "READY" Then
MsgBox "Verify the September baseline and set Checks B3 to READY.", vbExclamation
Exit Sub
End If
deliveredAmount = checks.Range("B4").Value2
deliveredOrders = checks.Range("B5").Value2
If Not IsNumeric(deliveredAmount) Or Not IsNumeric(deliveredOrders) Then
MsgBox "The linked dashboard amount and count need review.", vbExclamation
Exit Sub
End If
If CDbl(deliveredAmount) <> 4699# Or CDbl(deliveredOrders) <> 10# Or _
CStr(checks.Range("B6").Value2) <> "All cities" Then
MsgBox "The amount, order count or scope does not match the baseline.", vbExclamation
Exit Sub
End If
If Len(dashboard.PageSetup.PrintArea) = 0 Then
MsgBox "Set and review the Dashboard print area before exporting.", vbExclamation
Exit Sub
End If
checks.Range("B3").Value2 = "REVIEW"
chosenPath = Application.GetSaveAsFilename( _
InitialFileName:="FreshGo-SEP-BASE.pdf", _
FileFilter:="PDF Files (*.pdf), *.pdf", _
Title:="Export verified Dashboard as a new PDF")
If VarType(chosenPath) = vbBoolean Then Exit Sub
pdfPath = CStr(chosenPath)
If LCase$(Right$(pdfPath, 4)) <> ".pdf" Then
MsgBox "Choose a filename ending in .pdf.", vbExclamation
Exit Sub
End If
If Len(Dir$(pdfPath, vbReadOnly Or vbHidden Or vbSystem Or vbArchive)) > 0 Then
MsgBox "That file already exists. Use a new filename.", vbExclamation
Exit Sub
End If
dashboard.ExportAsFixedFormat _
Type:=xlTypePDF, Filename:=pdfPath, Quality:=xlQualityStandard, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
MsgBox "PDF written. Open it and verify the output:" & vbCrLf & pdfPath, vbInformation
Exit Sub
ExportFailed:
MsgBox "Could not finish the PDF export. " & Err.Description, vbExclamation
End Sub
Read the stopping points before trying the button
- Named workbook and sheets. Running a command against the active tab can target whatever the user clicked before running it. This procedure uses the workbook containing the code and two specific worksheet names. Missing names cause an error prompt.
- Fixed classroom baseline. The checks compare the reported scope, batch and a few visible controls. Independently verify that B4 and B5 link to numeric sources. A passing comparison is supplementary evidence, not a recalculation of the report from raw data.
- User-selected output. GetSaveAsFilename opens a dialog and returns a filename or a Boolean cancellation. It does not write the file by itself. The user chooses an explicit local practice location.
- New file path. The procedure checks the PDF suffix and tests for an existing file before writing. Use a private local exercise folder; this simple existence check is for one person working without a competing writer. A deliberate test can use a previously exported scratch PDF.
- Rendering and scope. ExportAsFixedFormat acts on Dashboard with its reviewed print area. The code doesn't refresh data, alter slicer selections, save the workbook or open other workbooks. It resets B3 before the dialog and writes a PDF only after the checks.
- Confirmation. The success message confirms the export call returned. Verify the file and its visible content yourself. On an error, inspect the target folder; do not assume an incomplete output is safe to share.
Distinguish macro code from its operating context
Read the declaration and the first calls before editing anything. Each name that follows Dim is a value local to a single run. It can hold a workbook object, a worksheet object or a return value. A Variant return value is used for the file chooser because it can contain either a filename or the Boolean cancellation. Keeping it as a Variant until that distinction is checked makes the cancel path simple. Once a path has been deliberately chosen, convert it to a String for the file operations.
Option Explicit helps catch a typo that would otherwise become an unexpected variable. It does not enforce a correct workbook, print area or valid business value. The worksheet checks use Value2, so the math compares the value itself rather than a formatted display such as ₹4,699. The project expects exact integer controls for amount and count. If your workbook has numbers stored as text, confirm and correct the typed input and link rather than accepting display alone. The small code is only a second guard behind those checks.
Follow each exit in order. The first gate stops a misnamed batch or an unverified status. Later checks stop unresolved linked values, changed baseline scope or a missing print area. Early exits are readable because each condition gives a related message. A permissions error while writing the file follows the error path. Preserve the difference between a rejected input, a user's chosen cancellation and an unexpected runtime error when you describe what happened.
Read the one workbook state change closely: when the checked routine reaches filename selection, B3 becomes REVIEW. That check cell is deliberately writable, unlike a protected calculation area. If you later protect the Checks worksheet and the routine cannot update that cell under your chosen settings, the exception is evidence that this exact template needs a compatible review arrangement. Do not lower protections for an unrelated workbook. Keep the manual procedure available for an approved viewer who cannot run or edit the macro.
Use explicit files and light-touch error handling
The sample asks for a path instead of deriving one from the workbook's directory. An unsaved workbook may not have the intended directory, and a workbook opened from a shared source could return a path inappropriate for local test output. Choose the private practice folder once you see the dialog, and record the resulting PDF path. A named output path retains evidence for the reviewer. A printed message with a short file name alone can be hard to distinguish when two test folders use the same default name.
The routine leaves Excel settings such as alert display and calculation mode alone. That makes it easier to recover from failure because there is little session state to restore. A learner may be tempted to add code that suppresses prompts until everything is convenient. That also removes information from the person doing the run. Keep a small routine focused on a selected worksheet and a chosen path until you can explain what every additional app setting changes.
Test the routine before assigning a shape
Make sure the workbook names and confirmation cells match the example. In the editor, compile the local VBA project if that command is available, then return to Excel. Start with an unready flag to confirm the macro stops before opening a filename dialog. Next verify the workbook and run it on one baseline practice view. Only then add a shape on Dashboard labeled Export verified PDF and assign the macro with the command appropriate to your Excel build. Keep the label aligned with the actual procedure. An “Export” button shouldn't imply all the query and data review operations ran.
After creating the macro, save the appropriate practice copy as .xlsm. Verify you know which file contains the code before handing it off. A separate .xlsx copy can serve readers who need only normal workbook use, with the macro behavior intentionally absent. Retain the original and any required class version. Saving a file with the macro-enabled extension does not give it approval to run in a colleague's environment.
Lab 1 · Produce a baseline PDF using the manual path
Prerequisites. Use the completed local dashboard, the reviewed September baseline, and a target test filename you control. Have a PDF reader available if you export. If your edition can only preview, complete the same comparison in the available preview and record the limitation.
- Confirm the five report figures and the underlying filters. Check the source sample date and one city contribution separately. Record all-city ₹4,699 and ten delivered, AOV ₹469.90, cancellation 1/12 and on time 6/8 with 8/10 timing coverage.
- Verify the Dashboard shows the sample period and the all-city scope. Set or inspect the worksheet print area. Look for an internal heading, clipped city name, tiny percentage, empty page or secondary sheet entering the output.
- Use your client's supported PDF export or local print-to-PDF route. Select Dashboard or the checked reporting area. Save a new local test file, for example
FreshGo-SEP-BASE-manual-test.pdf. Do not replace any approved submission. - Open the newly created PDF from its actual path. Confirm title, scope text, date range and figure values. Check a detailed value such as delivered peak ₹2,789 on 14 September. Read the last printed note and verify the file has no raw or directory tabs.
- Make a second scratch output with Pune selected and the scope visibly updated. Compare ₹1,610 and three delivered, as well as timing evidence 2/2 with coverage 2/3. A visible filter in the workbook should translate into a visible label in the static output.
- Record the expected and observed values, path, sample ID and reason for any fix. Restore baseline filters on the editable practice copy. Keep separate file names for the two outputs.
Expected result. The baseline export is readable on its own and matches the checked workbook. The Pune scratch artifact captures a different selected report and says so clearly. If only preview was available, your notes establish the scope and the evidence you were able to inspect.
Troubleshoot. If an exported file differs from preview, confirm the precise document path, active sheet and chosen export options. If a number differs from the checked data, inspect dependent summaries, source filters and labels. If the report is compressed, simplify the print layout before trying again.
Finish. Keep approved artifacts separately from scratch PDFs. Remove local scratch exports only after your learning evidence is captured. Verify no file was shared while testing.
Lab 2 · Exercise the macro's decision branches on a local copy
Prerequisites. Use an authorized Windows desktop Excel practice copy or use the paper-based branch walk-through below if you cannot run VBA. Back up the editable workbook, then use a private local test folder. The workbook should have your exact Checks and Dashboard sheet names, a reviewed print area and the original SEP-BASE data.
- Start with Checks B3 = REVIEW. Run the routine on the scratch file or predict the result from the first condition. It should stop before a filename prompt. Record the reason and confirm no new PDF appears.
- In the scratch view select only Pune and let linked values update. Write B3 = READY deliberately for this negative test. The routine should reject the amount, count or visible scope even if the flag says READY. The expected Pune inputs are ₹1,610, three and the visible Pune scope.
- Reset to the checked baseline. Inspect the print area, then set B3 = READY and run again. Cancel the filename dialog, expecting no output and B3 reset to REVIEW. This tests that closing a prompt is an intentional no-export outcome.
- Verify baseline again and assign a new PDF path in the local folder. Expect a file written only after the checks. Reopen and compare the artifact. Record which output path you inspected.
- Repeat the verified setup but select the already existing scratch file. If Excel's chooser itself asks about choosing that path, do not authorize overwriting an approved file. On a scratch expected case the routine's existence check should stop before the export call. Verify the earlier scratch artifact remains unchanged.
- If you cannot run the exercise, narrate those four cases on paper with input state, branch and expected artifact state. Compare them with the documented API behavior. Describe the work as a logic exercise, not as a native VBA or PDF test.
Expected result. The unready, mismatched, cancelled and existing-path cases produce no new PDF as designed, while a valid ready state with a new accessible path calls Excel's export. The successful call still needs the separate rendered file review.
Troubleshoot. If approved values pass even though a filter differs, inspect the linked cells and their scope label. The code only reads those prepared evidence values. If permission or naming prevents output, choose a permitted scratch folder or use manual preview. Investigate any actual export error before reusing the same filename.
Finish. Leave the reviewer flag at REVIEW after your exercise, restore the baseline view and retain the intended workbook extension. Keep any scratch copy that intentionally contains incorrect scope separate from the submitted version.
Document an update so a colleague can repeat it
Write a short walkthrough using your actual workflow. “Copy the new file, press refresh, press export” leaves out which file is expected, which rows should change and how to verify the current view. Name the source, procedure and check values. For different exports use separate path and source IDs. The colleague can then compare an older export and a newer one without reading every sheet.
Decide which part of each outcome you can assert
- A fresh input note records which source you intended to process. The approved output and a trace row provide evidence that the analyzed data relates to that input.
- A dependent calculation check identifies a correct expected selected point, such as 14 September or one region. It is useful alongside checking general totals.
- A completed export call indicates the app attempted and returned from its PDF creation operation. Reopen the exact file and inspect the displayed results, instead of checking only that a name exists.
- An authorized local print exercise produces local artifacts. Sharing is a separate action requiring the correct sanitized copy, intended audience and worksheet access decision from the project.
- A successful diagnostic variation cannot replace the tested default report. Preserve the baseline independently and record which conditions are for scratch tests only.
Consider a workbook where 17 September is the preparation date and the eligible period stays 12–16 September. The filename might include 17 September as a preparation note, but the report should still declare the actual transaction dates. If 17 September is a new eligible sales day in a different batch, the report period and reviewed evidence change too. An accurate filename supports the handoff; it cannot resolve the confusion between these two cases on its own.
Investigate a file that exists but does not match the release
Suppose the local folder contains FreshGo-SEP-BASE.pdf and FreshGo-SEP-BASE-v2.pdf. One shows ₹4,699 and six cities, and the other shows ₹1,610 and Pune. If the name of the second implies whole-region baseline, the static output is misleading even when both numbers came from correct workbook states. Compare the path and scope text rather than assuming recent modified time identifies the right one. Give the scratch file a name that describes both scope and role, such as FreshGo-SEP-Pune-scratch.pdf.
Open the correct file and check text before judging chart appearance. The ₹ symbol and date labels have to render clearly. A page can also print a chart shape but cut off its last two city categories, or page one may contain an unintended header while page two holds the numbers. If you intentionally use two pages, verify both pages have a clear order and enough context, or redesign the report as the one-page exercise requires. Evaluate the delivered document, not only the active Excel zoom state.
Write a small acceptance note with three fields: which worksheet view was approved, which path was examined, and which manual findings were observed in the PDF. Add whether the path came from the macro or the manual export. This note need not expose internal folder names or contact details to a report reader. Keep only the evidence the recipient needs and the additional test data the local maintainer needs to reproduce the run.
- If a warning says the folder isn't available, confirm the chosen path and permission. A new permitted test folder provides a clean repeat without overwriting an earlier result.
- If a path was rejected because a file already exists, use a new file name and compare both versions explicitly. A deliberate test should never rely on replacing the only good artifact.
- If a write error leaves an incomplete file, keep it outside the deliverable set. Record the failure, then choose a new path for the next verified attempt and open that output.
- If you need proof of the exact original file, retain it before redoing any test. A reproducible report includes a stable source version and a known saved artifact.
Recall without the code. State one distinct check for source freshness, one check of dashboard scope and one check that requires opening the finished PDF.
Check why a successful refresh status can coexist with old data
A particular worksheet-loaded Power Query failure can leave existing data in the affected Table without a VBA error from RefreshAll. Inspect the loaded result and its matching input individually.
Check what happens after cancelling the save dialog
The sample returned from filename selection without calling ExportAsFixedFormat. The readiness flag had already reset to REVIEW in the working copy.
Check what a file existence test establishes
It can avoid an obvious repeated path in a local single-user exercise. It does not establish the contents of a new PDF or provide a general shared-folder concurrency lock.
Check the type of evidence required for an automation claim
Say which route and tests you actually performed. If you reasoned about expected outcomes without desktop Excel, label that a trace rather than a native run.
Quiz · Reason through the export
1. What proves the intended new input was loaded? A. A new timestamp. B. The source version and a controlled loaded-row change match. C. A PDF exists.
B. Input and output evidence are both needed. A timestamp or existing file does not identify the records inside the report.
2. When a worksheet-loaded query fails under RefreshAll, can previous data remain? A. Yes, in the documented case. B. Only if all connections fail. C. A PDF command will update it.
A. Microsoft documents this case even with background refresh disabled, so verify loaded output separately.
3. Which file extension preserves the example VBA? A. .pdf. B. .xlsx. C. .xlsm.
C. A macro-enabled workbook retains the local exercise's code when saved as that format.
4. What does GetSaveAsFilename do by itself? A. Returns a path choice or cancellation. B. Renders every worksheet. C. Refreshes the workbook.
A. It gathers the user's location choice. Export happens in the separate worksheet call.
5. Why specify worksheet and print area? A. To always export the active summary. B. To render the intended visible report region. C. To include calculation tabs too.
B. The explicit worksheet and checked printable region make the output scope easier to reproduce.
6. What follows a successful export message? A. Immediate sharing. B. Open the produced PDF and compare the period, scope, values and readability. C. Save a new worksheet named PDF.
B. The application call and the final rendered document are separate evidence. Inspect the exact file you intend to use.
Interview practice
- Why didn't the button both refresh and export?
- I could verify the approved loaded result first, including failures where a generic refresh does not prove current data. The optional button handles only the repeated export task.
- What checks protect the template from an unintended filtered export?
- I verify source and summaries, restore a named default scope and check the visible amount and count. The example validates some linked cells, and I still verify other scope and date conditions manually.
- How did you avoid replacing an earlier artifact?
- I preserve it separately, choose a new local path for tests and review that path after the run. The example checks for an existing file before writing.
- How do you handle an app that cannot run VBA?
- I use the equivalent manual review, preview and supported PDF export process and report the tests I actually performed. A colleague can follow the same evidence without needing my VBA routine.
- What does an error handler add?
- It shows an actionable message instead of continuing as if the export succeeded. It cannot prove source correctness and should not cause an incomplete file to be accepted.
- What evidence belongs in a reusable handoff?
- I include source and report period, verified loaded and displayed results, the output name and a comparison of the actual artifact. I record separately whether the macro or manual route generated it.
Revision cards
- Input evidence. Check the intended source, approved row count and a traceable row before exporting.
- Display evidence. Verify the correct report period, active filters, values and print scope.
- Local macro. Save it in an authorized .xlsm copy and target the named workbook and sheet.
- Choice before write. A save dialog obtains a path. Cancelled and existing paths are separate outcomes.
- Defined help. A generic refresh does not detect every worksheet-loaded Power Query failure.
- Rendered output. Reopen the actual PDF and check it before delivery.