I want to disable saveAS in Microsoft PowerPoint Using VBA code.
I tried to use "PresentationBeforeSave", but I can't know when the user press saveAS Button Event from the file menu.
Related
I want to open a PowerPoint Presentation that has a write password, directly with VBA without showing the dialog box, which asks to enter the password or open as Read-Only.
I can do this in a Word document with the following code:
Sub openWriteProtectedWord()
Documents.Open FileName:="C:\Users\user\Desktop\Doc2.docx", ReadOnly:=True
End Sub
When this is executed the file opens automatically without showing the pop-up where I have to click Read-Only button.
The code for PowerPoint:
Sub openWriteProtected()
Presentations.Open FileName:="C:\Users\user\Desktop\test.pptx", ReadOnly:=msoTrue
End Sub
When the code is executed the pop-up dialog shows up to enter password or open as read-only.
Is this a missing feature for PowerPoint, or it is done in another way?
I have written excel VBA code containing Userform and added code to show userform and hide Thisworkbook when the macro is opened. It shows userform during Start up. How to see the vba code, when userform is opened? Clicking Alt+F11 on Userform is not taking to VBA editor.
Press the Shift key and hold it down while you open the file. This will prevent the macro from firing (I'm assuming you have Workbook_open setting both Application.Visible = False and your userform's .Show method?)
I have created an add-in file and placed it in the Microsoft add-in folder. Inside 'ThisWorkbook' of the add-in, I have it installing a menu command button or uninstalling the button (Depending on if you are installing or uninstalling the add-in)
My Goal:
I want another macro to run when I select the command bar button.
I'm using .OnAction = "Test_Macro"
I need the Test_Macro to be inside the add-in.
My Problem:
When I open up a random workbook, install the add-in, and press the button, I get an error saying "Cannot run the macro. The macro may not be available in this workbook".
But the macro is very clearly in this very same workbook. What is happening that I'm unaware of?
When you are in the VBA editor, right+click on the add-in in the left pane VBAProject('add-in') and highlight 'Insert' and select 'Module'
This is where you write the macro you want to use for .OnAction
Within Powerpoint 2010 I have customised a tab on ribbon with both standard and custom macro buttons using 'customize the ribbon'.
In an attempt to share this ribbon with friends I have exported the ribbon as an .exportedUI file and saved the presentation as a macro enabled template.
When I open up any file called (Presentation1) the buttons work fine as the name for the macros are 'Presentation1'!macro#. If I then save as or open another blank (Presentation 2) the buttons produce the error:
"The macro could not be found or has been disabled because of your security settings"
The problem appears to be with the name of the macro that is associated with the button.
Is it possible to mix custom with standard buttons on an exportable ribbon? Or will I have to create an add-in that produces a new tab then replicate the standard buttons required? I know it is possible to do this in Excel and in Word but in Powerpoint it appears not to be?
I have a macro in Powerpoint 2010 to open a new document based on a template based in a central location, to be installed on several machines.
Sub PowerpointTemplate()
Application.Presentations.Open ("file")
End Sub
Powerpoint does not save the macro. Even when setting "Macro in:" to "All open presentations", it seems to reset this selection to "Presentation 1". The macro works for the time that I have this current document open, but once I close Powerpoint and reopen it, the macro has been removed.
Is there anyway to set the macro to permanently apply to all presentations?
You need to create an Add-in and load it in order to make the code available to all open presentations.
Setting Macro In to All Open Presentations simply SHOWS you the available public macros in all open presentations; it has no effect on where the macro code is saved.