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

"MWE " wrote in message
...
Colleyville Alan wrote:
YOU DID NOT SET THE APPLICATION'S VISIBLE PROPERTY TO TRUE. TRY
INSERTING
IT AFTER THE CREATEOBJECT COMMAND AS SHOWN BELOW...


Your suggestion solved my problem. It seems so obvious ... However, it
also seems reasonable to me that the default for the visibility
property should be "true"

My code now does most of what I want. I am still running into a
strange problem when I try to process more than 49 ppt files in a row.
I create the ppt object, then sequence through a series of ppt files
(open, operate, save, close) and then quit the ppt object. If the
number of ppt files in the sequence is 49, I get an error. Initially
the error was "too many open windows". I fixed that by adding code to
close the active window right after closing the ppt file (which also
keeps the task bar from filling up with ppt icons). Now I get an error
indicating that the 50th file can not be opened even though all 49
previous ones have been closed.

Any thoughts?


Though I solved your problem, I am not a skilled programmer. But I had huge
problems with memory leaks and my program kept crashing until I put code in
to release memory at the end of each loop, just before the process repeated
itself. So I will post what I did and maybe you will find it of value.

In my case, I had an array with company info in it, was opening a PPT File
called "Template.ppt", then copying slides from other PPT files and pasting
them into it, then saving the presentation with the company name and going
on to the next company. I tell you all that so the following code at the
end of my procedure to clean up and release memory makes sense. It works,
but good programmers may find fault with it. Still my program was crashing
and no longer is
.................................................. ..........................
lots of code and then this to end the sub...
.................................................. ...........................

' This code sets the Title of the ppt file to the name of the Plan
Set oSlide = oPresTemplate.Slides(1)
Set oShape = oSlide.Shapes.Title
oShape.TextFrame.TextRange.Text = strPlanName
Set oShape = Nothing 'Added Aug 4 to release memory

' The following code gets rid of the forward slash that makes VBA think
I'm trying to create
' a new directory - this occurs in the abbreviation P/S for Profit
Sharing. I need to do
' this prior to trying to save the file since the file name is the plan
name with .PPT appended

While InStr(strPlanName, "/") 0
strPlanNameLeft = Mid$(strPlanName, 1, InStr(strPlanName, "/") - 1)
strPlanNameRight = Mid$(strPlanName, InStr(strPlanName, "/") + 1)
strPlanName = strPlanNameLeft & "_" & strPlanNameRight
Wend

'Save plan with name of company
oPresTemplate.SaveAs DestinationPath + strPlanName & ".PPT" 'Saves
File with Co Name

' Close saved plan and close the object for it
oPPT.Presentations(strPlanName & ".ppt").Close
Set oPresTemplate = Nothing ' added this to try and eliminate memory
leak

'Next line is code to reopen the template file since it was renamed in
the SaveAs procedure
Set oPresTemplate = oPPT.Presentations.Open(Path + filename9, msoFalse,
withwindow:=False)

End Sub


 
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
Help with manipulating data in excel? jock Excel Discussion (Misc queries) 3 July 29th 08 03:24 PM
Linked spreadsheets and Powerpoint Files EP Excel Discussion (Misc queries) 3 January 29th 08 03:12 AM
Can't open PowerPoint files Carl Goodin Excel Discussion (Misc queries) 2 December 14th 07 08:40 PM
Accessing PowerPoint files from Excel MWE[_31_] Excel Programming 1 April 8th 04 12:36 AM
Manipulating Excel pie charts with VB Andrew[_16_] Excel Programming 0 July 24th 03 12:59 AM


All times are GMT +1. The time now is 05:15 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"