Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Activating PowerPoint from Excel 1

Status
Not open for further replies.

originalxavier

Programmer
Mar 5, 2003
69
US
I need to switch back and forth between Excel and PowerPoint. I have the code for activating Excel, but when I try to use:

Code:
Dim ppt as New PowerPoint.Application
ppt.Windows("ccc_report.ppt").Activate

I get a runtime error for a type mismatch.

??????
Xavier ----------------------------------------
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far the Universe is winning."
Rich Cook
----------------------------------------
 
You're going too fast :)
Try two steps:

Dim ppt as PowerPoint.Application
set ppt = New PowerPoint.Application

Rob
[flowerface]
 
Still getting the same error... Here is the full code (unfinished):

Sub openppt()
Dim report As String
Dim ppt As PowerPoint.Application
Set ppt = New PowerPoint.Application
Dim newdatebegin As String
Dim newdateend As String

report = "h:\cccreports\ccc_report.ppt"
ppt.Visible = True
ppt.Presentations.Open filename:=report, _
ReadOnly:=False
ppt.Windows("ccc_report.ppt").Activate

'Set Date Values
Date = Date
newdatebegin = Date - 7
newdatebegin = Format(newdatebegin, "mm-dd-yyyy")
newdateend = Date - 1
newdateend = Format(newdateend, "mm-dd-yyyy")


End Sub

It is failing on the
Code:
"ppt.Windows("ccc_report.ppt").Activate"
code... ----------------------------------------
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far the Universe is winning."
Rich Cook
----------------------------------------
 
I haven't tried to reproduce your error, but I don't understand why you need the command at all - if you've just opened the presentation, it will be the active window.
Rob
[flowerface]
 
I need to switch between excel and ppt. Copy from excel then paste in ppt several times ----------------------------------------
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far the Universe is winning."
Rich Cook
----------------------------------------
 
Still, no need to activate the window within Powerpoint. You don't need to "activate" the Powerpoint application to manipulate your presentation. Just do all your copying/pasting with ppt in the background.
Rob
[flowerface]
 
Rob,

Thanks for all of your help. I was able to get it to work before you had gotten back to me but I appreciate all of your advice. I have also read your comments for other users and am glad you were one of the people to respond.

Thanks again
----------------------------------------
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far the Universe is winning."
Rich Cook
----------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top