Consulting

Results 1 to 5 of 5

Thread: Open userform in powerpoint from excel

  1. #1
    VBAX Regular
    Joined
    Sep 2020
    Location
    https://t.me/pump_upp
    Posts
    40
    Location

    Open userform in powerpoint from excel

    Sir,
    I have an Userform in PowerPoint say Userform1. Now I want to open this userform1 from excel sheet(command button). But below code is not working.
    NOTE: Frist I opened PowerPoint & then pressed command button in excel.


    Sub showUserForm()
    Dim PowerPointApp As Object
    Set PowerPointApp = GetObject(Class:="Powerpoint.application")
    PowerPointApp.Run (PowerPointApp.ActivePresentation.Name & "!UserForm1.Show")
    End Sub
    Attached Files Attached Files

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    I don't do PP, but maybe something like:
    Dim PPfile as Object
    Set PPFile = PowerPointApp.Open(PPFullFileName)
    PPFile.PPSubName
    Where PPFullFileName is the path and name to the pp file and PPSubName is the Name of a Procedure in the PP file that shows the UserForm in the PP File.

    Public Sub PPSubName()
       UserForm1.Show
    End Sub
    GetObject(Class:="Powerpoint.application") Opens a new PowerPoint with no file selected. Declaring the Form Show Sub as Public lets another Application(Excel) run it
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    The code to open the userform needs to be in the open PPT presentation

    If the sub is called showform and is in Module1

    Excel code woulkd look like

    Sub testme()
    Dim ppt As Object
    Dim strName As String
    Set ppt = GetObject(Class:="PowerPoint.Application")
    strName = ppt.activepresentation.Name
    ppt.Run strName & "!Module1.showform"
    End Sub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  4. #4
    VBAX Regular
    Joined
    Sep 2020
    Location
    https://t.me/pump_upp
    Posts
    40
    Location
    Quote Originally Posted by John Wilson View Post
    The code to open the userform needs to be in the open PPT presentation

    If the sub is called showform and is in Module1

    Excel code woulkd look like

    Sub testme()
    Dim ppt As Object
    Dim strName As String
    Set ppt = GetObject(Class:="PowerPoint.Application")
    strName = ppt.activepresentation.Name
    ppt.Run strName & "!Module1.showform"
    End Sub
    Thanks Sir. Its working.

  5. #5
    Banned VBAX Newbie
    Joined
    Aug 2021
    Posts
    3
    Location
    Since I am an inexperienced microsoft office user, I needed some help with Excel. Specifically, link excel to powerpoint in preparing a presentation. For me, the article on this topic became useful. Everything is very accessible and step by step.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •