How to Export Visible Slides with Hidden Backups in PowerPoint VBA
Question details
The user needs to create separate PowerPoint presentations using VBA, where each new file contains a single visible slide paired with its subsequent hidden backup slide, while maintaining the hidden status.

- Product
- Microsoft PowerPoint
- Device & OS
- not provided
- Scenario
- Running a VBA macro to split a large presentation into smaller files containing specific visible and hidden slide pairs, but the macro is incorrectly separating or skipping the hidden slides.
- Observed behavior
- The macro either outputs four separate files (detaching the hidden slides from their visible counterparts) or skips the hidden slides entirely due to restrictive conditional filtering in the code.
Before modifying your VBA macro, save a backup copy of your master presentation in a safe location, as macro actions cannot typically be undone via the standard undo button.
Adjust the VBA Macro Logic to Group Visible and Hidden Slides
Remove the conditional statements that exclude hidden slides from the VBA loop to ensure they are processed and kept with their corresponding visible slides.
When writing macros to process presentation decks, checking slide visibility is common. However, if your goal is to explicitly include hidden backup slides alongside visible ones, filtering them out will break the pairing logic.
By modifying the slide loop and utilizing the SaveCopyAs method, you can accurately split the deck into the desired paired files.
Press Alt + F11 in PowerPoint to launch the Visual Basic for Applications editor, then locate the module containing your export macro.
Find the line of code that reads `If Not oSld.SlideShowTransition.Hidden Then`. Delete or comment out this line entirely.
Scroll down to the end of that conditional block and delete the matching `End If` statement to prevent syntax errors during execution.
Ensure your code logic duplicates the presentation, deletes unrelated slides to leave only the target visible slide and its hidden counterpart, and then uses `Presentation.SaveCopyAs` to generate the new file.
Check your code for any unintended blank lines or formatting errors introduced by copying from forums. Save your macro and run it to verify that two files are created, each containing a paired visible and hidden slide.

Manage and Export Slides Seamlessly with WPS Presentation
WPS Presentation provides advanced developer tools and an intuitive interface, allowing you to easily manage slide visibility and run VBA macros for complex export scenarios.
- 1. Download and Install WPS Office: Download WPS Office and open your master presentation file in WPS Presentation.
- 2. Access Developer Tools: Navigate to the 'Developer' tab on the main ribbon to access the VBA environment.
- 3. Run Your Export Macro: Click 'Macros', input or paste your adjusted slide-pairing VBA code, and click 'Run' to generate your separated files.
- 4. Manual Alternative: If you prefer not to use VBA, simply hold Ctrl to select your visible slide and its hidden backup, copy them, and paste them into a blank presentation, preserving original formatting.

Frequently Asked Questions
Why is my PowerPoint macro ignoring hidden slides entirely?
Your macro likely includes a condition such as `If Not oSld.SlideShowTransition.Hidden Then`. This explicitly tells the code to skip any slide marked as hidden. Removing this condition will allow the code to process hidden slides.
Does exporting a hidden slide automatically make it visible in the new file?
No. When you duplicate a presentation or copy-paste slides using VBA or manual methods, the slide's visibility properties (such as the Hidden status) are preserved in the destination file.
What is the best VBA method to save portions of a presentation?
The most reliable method is to duplicate the entire presentation, delete the slides you do not need in the copy, and then use the `Presentation.SaveCopyAs` method to save the result as a new file without overwriting your original.
Why is my VBA code throwing a syntax error after removing the hidden slide filter?
If you remove an `If` statement, you must also remove its corresponding `End If` statement later in the code. Failing to do so breaks the code's structure and triggers a block syntax error.




