Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Open Powerpoint Presentation via Excel VBA code

I have an excel macro in which I would like to open a powerpoint presentation
based upon a selection made in a drop-down box. The code I have so far is
below, I just don't know how to tell excel how to open the presentation.
Thanks.

Private Sub Business_Plan_Change()
Workbooks.Open Filename:="F:\Reports\" & Business_Plan.Value & ".ppt"
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Open Powerpoint Presentation via Excel VBA code

It looks as though the code you have below is trying to open a PPT file in
Excel. From what you've written, I don't think that's what you actually
want to do.

To open a PPT presentation by running code in Excel, you need to do four
things - add a reference to the powerpoint object model, boot powerpoint,
make powerpoint visible, and then open the file you want.

To add the reference:
Open VBE (Alt F11)
Tools / References
Scan down for "Microsoft Powerpoint <version Object Library"
Check the box
Click OK

Once you've added the reference, the following code should do what you want:

Private Sub Business_Plan_Change()
Dim PPT As PowerPoint.Application
Set PPT = New PowerPoint.Application
PPT.Visible = True
PPT.Presentations.Open Filename:="F:\Reports\" & Business_Plan.Value &
".ppt"
End Sub

Hope that helps.

- Andy Tischaefer
Test Lead, Microsoft Office

This posting is provided as is, and confers no rights.

"hurlbut777" wrote in message
...
I have an excel macro in which I would like to open a powerpoint
presentation
based upon a selection made in a drop-down box. The code I have so far is
below, I just don't know how to tell excel how to open the presentation.
Thanks.

Private Sub Business_Plan_Change()
Workbooks.Open Filename:="F:\Reports\" & Business_Plan.Value & ".ppt"
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Open Powerpoint Presentation via Excel VBA code

When I follow the prescribed instructions, I get a run-time error
'-2147467259 (80004005)'; PowerPoint could not open the file

"Andy Tischaefer [MSFT]" wrote:

It looks as though the code you have below is trying to open a PPT file in
Excel. From what you've written, I don't think that's what you actually
want to do.

To open a PPT presentation by running code in Excel, you need to do four
things - add a reference to the powerpoint object model, boot powerpoint,
make powerpoint visible, and then open the file you want.

To add the reference:
Open VBE (Alt F11)
Tools / References
Scan down for "Microsoft Powerpoint <version Object Library"
Check the box
Click OK

Once you've added the reference, the following code should do what you want:

Private Sub Business_Plan_Change()
Dim PPT As PowerPoint.Application
Set PPT = New PowerPoint.Application
PPT.Visible = True
PPT.Presentations.Open Filename:="F:\Reports\" & Business_Plan.Value &
".ppt"
End Sub

Hope that helps.

- Andy Tischaefer
Test Lead, Microsoft Office

This posting is provided as is, and confers no rights.

"hurlbut777" wrote in message
...
I have an excel macro in which I would like to open a powerpoint
presentation
based upon a selection made in a drop-down box. The code I have so far is
below, I just don't know how to tell excel how to open the presentation.
Thanks.

Private Sub Business_Plan_Change()
Workbooks.Open Filename:="F:\Reports\" & Business_Plan.Value & ".ppt"
End Sub




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Open Powerpoint Presentation via Excel VBA code

That error indicates that the path you're providing to your powerpoint file
is not valid. To debug, you might try:

dim filepath as string
filepath = "F:\Reports\" & Business_Plan.Value & ".ppt"

and then verify that filepath is what you expect to be, and that it is
pointing to a valid file.

Hope that helps.

- Andy Tischaefer
Test Lead, Microsoft Office

This posting is provided as is, and confers no rights.

"hurlbut777" wrote in message
...
When I follow the prescribed instructions, I get a run-time error
'-2147467259 (80004005)'; PowerPoint could not open the file

"Andy Tischaefer [MSFT]" wrote:

It looks as though the code you have below is trying to open a PPT file
in
Excel. From what you've written, I don't think that's what you actually
want to do.

To open a PPT presentation by running code in Excel, you need to do four
things - add a reference to the powerpoint object model, boot powerpoint,
make powerpoint visible, and then open the file you want.

To add the reference:
Open VBE (Alt F11)
Tools / References
Scan down for "Microsoft Powerpoint <version Object Library"
Check the box
Click OK

Once you've added the reference, the following code should do what you
want:

Private Sub Business_Plan_Change()
Dim PPT As PowerPoint.Application
Set PPT = New PowerPoint.Application
PPT.Visible = True
PPT.Presentations.Open Filename:="F:\Reports\" & Business_Plan.Value
&
".ppt"
End Sub

Hope that helps.

- Andy Tischaefer
Test Lead, Microsoft Office

This posting is provided as is, and confers no rights.

"hurlbut777" wrote in message
...
I have an excel macro in which I would like to open a powerpoint
presentation
based upon a selection made in a drop-down box. The code I have so far
is
below, I just don't know how to tell excel how to open the
presentation.
Thanks.

Private Sub Business_Plan_Change()
Workbooks.Open Filename:="F:\Reports\" & Business_Plan.Value & ".ppt"
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
Excel problem with editing in a PowerPoint Presentation FrankTimJr Excel Discussion (Misc queries) 0 January 18th 10 09:56 PM
can I merge data from Excel document into PowerPoint presentation judith28 Excel Discussion (Misc queries) 1 November 9th 08 11:03 PM
How do I insert an Excel file into a PowerPoint Presentation slid. Barb Excel Worksheet Functions 1 December 11th 04 04:23 PM
How do I insert an Excel file into a PowerPoint Presentation slid. Barb Excel Discussion (Misc queries) 1 December 11th 04 04:22 PM
Creating a powerpoint presentation from MS-Excel Shilps[_2_] Excel Programming 3 August 1st 04 03:47 AM


All times are GMT +1. The time now is 08:57 AM.

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

About Us

"It's about Microsoft Excel"