![]() |
Help in opening powerpoint file variable from excel
Hi all,
Was wondering if anyone could help me out. I am trying to open a new point file or an existing powerpoint file based on a user's input from the UserForm. Problem I am having is with the below line: "PPApp.Presentations.Open Filename:=Enginename" I cannot seem to open the powerpoint file using a variable name. Can anyone help? Thanks. Below is the full code that I have. Any help making this simple would also be appreciated. :) Sub ShowUserForm() Dim Enginename As Variant Dim Template As Variant Dim oPPt As Object Dim PPSlide As Object Dim PPApp As Object Dim PPPres As Object Dim SlideCount As Long PptTemplate.Show If PptTemplate.NewPpt.Value = True Then Set oPPt = CreateObject("PowerPoint.Application") oPPt.Visible = True oPPt.Presentations.Add Set PPApp = GetObject(, "Powerpoint.Application") Set PPPres = PPApp.ActivePresentation SlideCount = PPPres.Slides.Count Set PPSlide = PPPres.Slides.Add(SlideCount + 1, ppLayoutBlank) PPApp.ActiveWindow.View.GotoSlide PPSlide.SlideIndex PptTemplate.Hide ElseIf PptTemplate.TemplatePpt.Value = True Then Enginename = PptTemplate.TemplatePpt.Value Application.GetOpenFilename("Powerpoint Files (*.ppt), .ppt", , "Please choose Powerpoint Template for presentation", , True) = Enginename If TypeName(Enginename) = "Boolean" Then MsgBox "You have chosen to cancel the process! The application will end. Please restart the application!", vbExclamation, "Information" Else Set oPPt = CreateObject("PowerPoint.Application") oPPt.Visible = True Set PPApp = GetObject(, "Powerpoint.Application") PPApp.Presentations.Open Filename:=Enginename End If PptTemplate.Hide End If End Sub |
Help in opening powerpoint file variable from excel
this line is backwards:
Application.GetOpenFilename("Powerpoint Files (*.ppt), .ppt", , "Please choose Powerpoint Template for presentation", , True) = Enginename Enginename = Application.GetOpenFilename() -- Regards, Tom Ogilvy "Mithi_M" wrote in message om... Hi all, Was wondering if anyone could help me out. I am trying to open a new point file or an existing powerpoint file based on a user's input from the UserForm. Problem I am having is with the below line: "PPApp.Presentations.Open Filename:=Enginename" I cannot seem to open the powerpoint file using a variable name. Can anyone help? Thanks. Below is the full code that I have. Any help making this simple would also be appreciated. :) Sub ShowUserForm() Dim Enginename As Variant Dim Template As Variant Dim oPPt As Object Dim PPSlide As Object Dim PPApp As Object Dim PPPres As Object Dim SlideCount As Long PptTemplate.Show If PptTemplate.NewPpt.Value = True Then Set oPPt = CreateObject("PowerPoint.Application") oPPt.Visible = True oPPt.Presentations.Add Set PPApp = GetObject(, "Powerpoint.Application") Set PPPres = PPApp.ActivePresentation SlideCount = PPPres.Slides.Count Set PPSlide = PPPres.Slides.Add(SlideCount + 1, ppLayoutBlank) PPApp.ActiveWindow.View.GotoSlide PPSlide.SlideIndex PptTemplate.Hide ElseIf PptTemplate.TemplatePpt.Value = True Then Enginename = PptTemplate.TemplatePpt.Value Application.GetOpenFilename("Powerpoint Files (*.ppt), .ppt", , "Please choose Powerpoint Template for presentation", , True) = Enginename If TypeName(Enginename) = "Boolean" Then MsgBox "You have chosen to cancel the process! The application will end. Please restart the application!", vbExclamation, "Information" Else Set oPPt = CreateObject("PowerPoint.Application") oPPt.Visible = True Set PPApp = GetObject(, "Powerpoint.Application") PPApp.Presentations.Open Filename:=Enginename End If PptTemplate.Hide End If End Sub |
All times are GMT +1. The time now is 08:54 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com