LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Accessing PowerPoint files from Excel

I have an application that could be run from Powerpoint with som
interaction with Excel worksheets or from Excel with some interactio
with Powerpoint presentations. I have tried both approach and each ha
problems.

If *Powerpoint is the master*, I create an Excel object, open
workbook, do operations, close and save, and then quit the Exce
object. I am using slightly modified code that runs fine in Outlook.
It runs fine in Powerpoint too unless I try to save the workbook durin
the close. If I do that, the appl hangs. Relevant code is reproduce
below:

'
' define Excel types and definitions
'
Dim xLApp As Excel.Application
Dim xLBook As Excel.Workbook
Dim xLSheet As Excel.Worksheet
Dim xLPath As String, xLFileName As String
'
' define location & filename of target spreadsheet
'
xLPath = ActivePresentation.Path
xLFileName = "SSU_Setup.xls"
'
' define application object
'
Set xLApp = CreateObject("Excel.Application")
'
' open target spreadsheet
' define target worksheet
'
xLApp.Workbooks.Open FileName:=xLPath + "\" +
xLFileName
Set xLSheet = xLApp.Workbooks
(xLFileName).Worksheets("SSU_CurrentProject")
'
' do stuff with the spreadsheet
'
stuff
stuff
'
' close spreadsheet, quit xL
'
xLApp.Workbooks(xLFileName).Close
SaveChanges:=False
xLApp.Quit


This works fine. However if I alter the Close statement to save th
spreadsheet, i.e., SaveChanges:=True the application hangs. If I g
to "Task Manager" and end the PPT session, I am then prompted with
"SAVE AS" window for the spreadsheet. If I try to save the spreadshee
over itself, I get the standard message asking me if I really want t
do that. Regardless of how I answer, the SAVE AS window remains activ
until I cancel it. This inability to save the spreadsheet using th
above code is
unique to PowerPoint, i.e., it seems to work OK in Word and Outlook.

I would rather use *Excel as the master*. I roughed out equivalen
code, relevant stuff is reproduced below

'
' define PPT types and definitions
'
Dim pptApp As PowerPoint.Application
Dim pptPresentation As PowerPoint.Presentation
Dim pptSlide As PowerPoint.Slide
Dim pptPath As String, pptFileName As String
'
' define location and filename of target presentation
'
pptPath = ActiveWorkbook.Path
'
' define ppt application object
'
Set pptApp = CreateObject("Powerpoint.Application")
'
' open PPT file
'
pptApp.Presentations.Open Filename:=pptPath + "\" +PPTFileName


I get an error on the Open statement:

RunTime error
Presentations (unknown member) Invalid request. The Powerpoint fram
window does not exist.

The Open statement is identical to an open statement if Powerpoint wer
that master, but in that case the statement would be:

Application.Presentations.Open Filename:= ...

When I look at the values for pptPath and PPTFileName, they ar
correct.

Any help would be appreciated

--
Message posted from http://www.ExcelForum.com

 
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
Accessing imported Excel files after Office 2003 SP3 upgrade kmitch Excel Discussion (Misc queries) 0 November 9th 07 01:13 PM
Accessing cells in other files [email protected] Excel Discussion (Misc queries) 4 October 5th 06 02:32 PM
Trouble accessing a couple of established Excel 97 files lkpringle Excel Discussion (Misc queries) 2 August 11th 05 12:39 AM
Accessing PowerPoint datalabels from excel VBA KD[_3_] Excel Programming 1 November 14th 03 04:36 PM
Accessing document properties of non-Microsoft product files Kevin Beckham Excel Programming 5 November 5th 03 01:36 AM


All times are GMT +1. The time now is 05:27 PM.

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"