Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-04-2016, 10:58 AM
copleyr copleyr is offline Force a user to enable macros in Powerpoint? Hide sheets until the "enable" button is clicked Windows 10 Force a user to enable macros in Powerpoint? Hide sheets until the "enable" button is clicked Office 2010 32bit
Novice
Force a user to enable macros in Powerpoint? Hide sheets until the "enable" button is clicked
 
Join Date: Oct 2016
Posts: 1
copleyr is on a distinguished road
Default Force a user to enable macros in Powerpoint? Hide sheets until the "enable" button is clicked

I am in need of a technique to ensure the user has enabled macros. Possibly, a particular method that could hide all slides except a "welcome" slide which tells the user to enable macros, and is enforced every time the workbook is saved. I do have code, but it's for Excel. Is there any way to do this in Powerpoint?


Option Explicit

Const WelcomePage = "Macros"

Private Sub Workbook_BeforeClose(Cancel As Boolean)
'Turn off events to prevent unwanted loops
Application.EnableEvents = False

'Evaluate if workbook is saved and emulate default propmts
With ThisWorkbook
If Not .Saved Then
Select Case MsgBox("Do you want to save the changes you made to '" & .Name & "'?", _
vbYesNoCancel + vbExclamation)
Case Is = vbYes
'Call customized save routine
Call CustomSave
Case Is = vbNo
'Do not save
Case Is = vbCancel
'Set up procedure to cancel close
Cancel = True
End Select
End If

'If Cancel was clicked, turn events back on and cancel close,
'otherwise close the workbook without saving further changes
If Not Cancel = True Then
.Saved = True
Application.EnableEvents = True


.Close savechanges:=False
Else
Application.EnableEvents = True
End If
End With
End Sub

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
'Turn off events to prevent unwanted loops
Application.EnableEvents = False

'Call customized save routine and set workbook's saved property to true
'(To cancel regular saving)
Call CustomSave(SaveAsUI)
Cancel = True

'Turn events back on an set saved property to true
Application.EnableEvents = True
ThisWorkbook.Saved = True
End Sub

Private Sub Workbook_Open()
'Unhide all worksheets
Application.ScreenUpdating = False
Call ShowAllSheets
Application.ScreenUpdating = True
End Sub

Private Sub CustomSave(Optional SaveAs As Boolean)
Dim ws As Worksheet, aWs As Worksheet, newFname As String
'Turn off screen flashing
Application.ScreenUpdating = False

'Record active worksheet
Set aWs = ActiveSheet

'Hide all sheets
Call HideAllSheets

'Save workbook directly or prompt for saveas filename
If SaveAs = True Then
newFname = Application.GetSaveAsFilename( _
fileFilter:="Excel Files (*.xls), *.xls")
If Not newFname = "False" Then ThisWorkbook.SaveAs newFname
Else
ThisWorkbook.Save
End If

'Restore file to where user was
Call ShowAllSheets
aWs.Activate

'Restore screen updates
Application.ScreenUpdating = True
End Sub

Private Sub HideAllSheets()
'Hide all worksheets except the macro welcome page
Dim ws As Worksheet

Worksheets(WelcomePage).Visible = xlSheetVisible

For Each ws In ThisWorkbook.Worksheets
If Not ws.Name = WelcomePage Then ws.Visible = xlSheetVeryHidden
Next ws

Worksheets(WelcomePage).Activate
End Sub

Private Sub ShowAllSheets()
'Show all worksheets except the macro welcome page

Dim ws As Worksheet

For Each ws In ThisWorkbook.Worksheets
If Not ws.Name = WelcomePage Then ws.Visible = xlSheetVisible
Next ws

Worksheets(WelcomePage).Visible = xlSheetVeryHidden
End Sub
Reply With Quote
  #2  
Old 10-07-2016, 01:15 AM
JohnWilson JohnWilson is offline Force a user to enable macros in Powerpoint? Hide sheets until the "enable" button is clicked Windows 7 64bit Force a user to enable macros in Powerpoint? Hide sheets until the "enable" button is clicked Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,912
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

There is no equivalent to Hde Sheets in PPT so you cannot do anything similar.
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Force a user to enable macros in Powerpoint? Hide sheets until the "enable" button is clicked Enable Outlook Macros paul h Outlook 3 07-15-2016 08:35 AM
Force a user to enable macros in Powerpoint? Hide sheets until the "enable" button is clicked How to automatically enable the macros upon opening a file with macros? laurieli Office 7 01-17-2016 08:56 AM
How to automatically enable macros upon opening the Word? laurieli Word VBA 2 12-22-2015 02:46 PM
Force a user to enable macros in Powerpoint? Hide sheets until the "enable" button is clicked Enable "check spelling as you type" for Form Fields zeroth Word 3 11-08-2012 08:57 AM
How to enable PowerPoint Macros? delete123 PowerPoint 3 03-27-2012 06:56 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:08 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft