Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
updating embedded powerpoint in excel file txm49 Excel Discussion (Misc queries) 0 September 24th 09 08:16 PM
Need to copy chart of excel to powerpoint file without the other s אביתר Charts and Charting in Excel 1 July 20th 09 11:10 PM
Hyperlink from Excel to Powerpoint file opens as slideshow, why? Sntee Excel Discussion (Misc queries) 0 April 11th 07 12:30 PM
links to a powerpoint file in excel Jim in Florida Excel Discussion (Misc queries) 1 March 23rd 07 10:40 PM
Opening a new PowerPoint chart with excel vba KDUT Excel Programming 1 May 15th 04 04:39 AM


All times are GMT +1. The time now is 03:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"