View Single Post
 
Old 10-24-2020, 09:19 PM
Pastor Pastor is offline Windows 10 Office 2019
Novice
 
Join Date: Oct 2020
Posts: 4
Pastor is on a distinguished road
Question PPT Macro wont change userform name

I've entered this macro code into a module in a new ppt vbproject module:

Public Sub Rebuild_Custom_Message_Box()

Dim oForm As Object

'Create a FORM = .Add(3) /3 = MSFORM's type value
Set oForm = ActivePresentation.VBProject.VBComponents.Add(vbex t_ct_MSForm)

'Change the Name of the new form
oForm.Name = "CustomMsgBox"

'Change the Caption
oForm.Caption = "Message"

End Sub


See attached Word Document with two screen shots of the error.

I get a runtime error " #75: could not find the specified object" on the line shown in red text.

Userform1 is created and appears in the VBProject pane under the Forms folder Icon.

What is the correct macro code to change the name and caption of a newly created UserForm?


Thanks for your time, effort and concern in this matter.
Reply With Quote