Prev: macros
Next: Template Path in Windows 7
From: Shyam Pillai on 3 Apr 2010 15:18 Hello Vic, My recommendation is that you spend some time reading up on the PowerPoint object model rather that simply making edits to existing code without understanding the underlying fundamentals. 1st: ".pptxm" is not an extension. It is either ".pptm" or ".pptx" Correct this line: deffilename = App.Path & "\" & main.cboChartSelection & "\MyTemplate.pptm" 2nd: Look up the help file for the Presentations.Open or Presentations.Open2007 method. Pass false for the WithWindow argument. Examples: Set OpwrPresent = oPwrpnt.Presentations.Open(deffilename, , , False).Slides(1) or Set OpwrPresent = oPwrpnt.Presentations.Open2007(deffilename, , , False).Slides(1) Regards, Shyam Pillai Image Importer Wizard: http://skp.mvps.org/iiw.htm > Shyamm, > > I had already tried that but it also fails with "following statement > fails with the error: 'Presentations (unknown member) : Invalid > request. The PowerPoint Frame window does not exist." if don't have > oPwrpnt.Activate included which causes the blank PPT screen to be > flashed. > > Vic > > "Shyam Pillai" <ShyamPillai(a)Gmail.com> wrote in message > news:e$RcSD00KHA.220(a)TK2MSFTNGP06.phx.gbl... > >> The Open method accepts 4 arguments. One of them is - WithWindow, set >> that to False. >> >> Regards, >> Shyam Pillai >> Handout Wizard: http://skp.mvps.org/how >> >> "Vic" <vic(a)showsec.com> wrote in message >> news:AEADBAFE-56D2-4025-B703-E47FCC04686A(a)microsoft.com... >> >>> Hello, >>> >>> I am trying to automate the creation of building the PPT file and I >>> want to hide the process. However, I can't seem to get rid of >>> having to activate the application object which cause a blank PPT >>> screen to flash. The "Unknown Member" seems to be what has to be >>> identified but how?? Following is the code with comments attached to >>> what I've tried. >>> >>> Thank you very much, Vic >>> >>> Set oPwrpnt = CreateObject("Powerpoint.application") >>> >>> ' oPwrpnt.Visible = False <<=== This fails Application >>> (unknown member) : Invalid request. Hiding the application window >>> is not >>> allowed. >>> oPwrpnt.Activate <<== will flash a blank PPT screen >>> 'oPwrpnt.WindowState = ppWindowMinimized <<== Fails if the >>> above is commented out >>> deffilename = App.Path & "\" & main.cboChartSelection & >>> "\MyTemplate.pptxm" >>> >>> 'following statement fails with the error: 'Presentations (unknown >>> member) : Invalid request. The PowerPoint Frame window does not >>> exist. ' if oPwrpnt.Activate is commented out >>> >>> Set OpwrPresent = oPwrpnt.Presentations.Open(deffilename).Slides(1) >>> >>> 'Also the following fails with the same error as above >>> Set OpwrPresent = oPwrpnt.Presentations.Open(deffilename, >>> False).Slides(1)
From: Vic on 4 Apr 2010 14:11 Shyam, I have been reading everything I can find on the subject and I am getting a better understanding of the process but still a long way to go. I don't know why suppressing the creation of a presentation should be so problematic but it is. If I try to just minimize it, I have to activate it, and it flashes a blank screen. The pptxm was a typo and I didn't realize what these "m" files were utill the other day when I added some vba code to the presentation file. I was careless and not paying close enough attention to details and consequently made the typo. OK that said, I almost have this thing working as it has completed the creation of the slide with multiple graphs from the database but now when I try to save the final slide it says there is no active presentation (Application (unknown member) : Invalid request. There is no active presentation.). The statement to save is "oPwrpnt.ActivePresentation.SaveAs (CGFF_PPTFileName)". I open it with "Set OpwrPresent = oPwrpnt.Presentations.Open(deffilename, , , False).Slides(1)". So Shyam how do I save the completed slide if there is not an active presentation? Thanks, Vic "Shyam Pillai" <ShyamPillai(a)gmail.com> wrote in message news:7c5b0b4a892d8cca13ee8123859(a)msnews.microsoft.com... > Hello Vic, > My recommendation is that you spend some time reading up on the PowerPoint > object model rather that simply making edits to existing code without > understanding the underlying fundamentals. > > 1st: ".pptxm" is not an extension. It is either ".pptm" or ".pptx" > Correct this line: deffilename = App.Path & "\" & main.cboChartSelection & > "\MyTemplate.pptm" > > > 2nd: Look up the help file for the Presentations.Open or > Presentations.Open2007 method. Pass false for the WithWindow argument. > Examples: > Set OpwrPresent = oPwrpnt.Presentations.Open(deffilename, , , > False).Slides(1) > > or Set OpwrPresent = oPwrpnt.Presentations.Open2007(deffilename, , , > False).Slides(1) > > > Regards, > Shyam Pillai > > Image Importer Wizard: http://skp.mvps.org/iiw.htm > > >> Shyamm, >> >> I had already tried that but it also fails with "following statement >> fails with the error: 'Presentations (unknown member) : Invalid >> request. The PowerPoint Frame window does not exist." if don't have >> oPwrpnt.Activate included which causes the blank PPT screen to be >> flashed. >> >> Vic >> >> "Shyam Pillai" <ShyamPillai(a)Gmail.com> wrote in message >> news:e$RcSD00KHA.220(a)TK2MSFTNGP06.phx.gbl... >> >>> The Open method accepts 4 arguments. One of them is - WithWindow, set >>> that to False. >>> >>> Regards, >>> Shyam Pillai >>> Handout Wizard: http://skp.mvps.org/how >>> >>> "Vic" <vic(a)showsec.com> wrote in message >>> news:AEADBAFE-56D2-4025-B703-E47FCC04686A(a)microsoft.com... >>> >>>> Hello, >>>> >>>> I am trying to automate the creation of building the PPT file and I >>>> want to hide the process. However, I can't seem to get rid of >>>> having to activate the application object which cause a blank PPT >>>> screen to flash. The "Unknown Member" seems to be what has to be >>>> identified but how?? Following is the code with comments attached to >>>> what I've tried. >>>> >>>> Thank you very much, Vic >>>> >>>> Set oPwrpnt = CreateObject("Powerpoint.application") >>>> >>>> ' oPwrpnt.Visible = False <<=== This fails Application >>>> (unknown member) : Invalid request. Hiding the application window >>>> is not >>>> allowed. >>>> oPwrpnt.Activate <<== will flash a blank PPT screen >>>> 'oPwrpnt.WindowState = ppWindowMinimized <<== Fails if the >>>> above is commented out >>>> deffilename = App.Path & "\" & main.cboChartSelection & >>>> "\MyTemplate.pptxm" >>>> >>>> 'following statement fails with the error: 'Presentations (unknown >>>> member) : Invalid request. The PowerPoint Frame window does not >>>> exist. ' if oPwrpnt.Activate is commented out >>>> >>>> Set OpwrPresent = oPwrpnt.Presentations.Open(deffilename).Slides(1) >>>> >>>> 'Also the following fails with the same error as above >>>> Set OpwrPresent = oPwrpnt.Presentations.Open(deffilename, >>>> False).Slides(1) > >
From: Shyam Pillai on 5 Apr 2010 14:31 Since your PowerPoint window is hidden there is no ActivePresentation. You need to reference the presentation you are opening so that you can save that presentation later. 'Reference to the presentation Dim oPres as PowerPoint.Presentation Set oPres=oPwrpnt.Presentations.Open(deffilename, , , False) Set OpwrPresent =oPres.Slides(1). .... When you are ready to save use: Call oPres.SaveAs (CGFF_PPTFileName). Close the presentation and clear the refrence. oPres.Close Set oPres=Nothing Regards, Shyam Pillai Handout Wizard: http://skp.mvps.org/how "Vic" <vic(a)showsec.com> wrote in message news:#Mg2EKC1KHA.220(a)TK2MSFTNGP06.phx.gbl... > Shyam, > > I have been reading everything I can find on the subject and I am getting > a better understanding of the process but still a long way to go. I don't > know why suppressing the creation of a presentation should be so > problematic but it is. If I try to just minimize it, I have to activate > it, and it flashes a blank screen. The pptxm was a typo and I didn't > realize what these "m" files were utill the other day when I added some > vba code to the presentation file. I was careless and not paying close > enough attention to details and consequently made the typo. > > OK that said, I almost have this thing working as it has completed the > creation of the slide with multiple graphs from the database but now when > I try to save the final slide it says there is no active presentation > (Application (unknown member) : Invalid request. There is no active > presentation.). The statement to save is > "oPwrpnt.ActivePresentation.SaveAs (CGFF_PPTFileName)". I open it with > "Set OpwrPresent = oPwrpnt.Presentations.Open(deffilename, , , > False).Slides(1)". > > So Shyam how do I save the completed slide if there is not an active > presentation? > > Thanks, > > Vic > > > > "Shyam Pillai" <ShyamPillai(a)gmail.com> wrote in message > news:7c5b0b4a892d8cca13ee8123859(a)msnews.microsoft.com... >> Hello Vic, >> My recommendation is that you spend some time reading up on the >> PowerPoint object model rather that simply making edits to existing code >> without understanding the underlying fundamentals. >> >> 1st: ".pptxm" is not an extension. It is either ".pptm" or ".pptx" >> Correct this line: deffilename = App.Path & "\" & main.cboChartSelection >> & "\MyTemplate.pptm" >> >> >> 2nd: Look up the help file for the Presentations.Open or >> Presentations.Open2007 method. Pass false for the WithWindow argument. >> Examples: >> Set OpwrPresent = oPwrpnt.Presentations.Open(deffilename, , , >> False).Slides(1) >> >> or Set OpwrPresent = oPwrpnt.Presentations.Open2007(deffilename, , , >> False).Slides(1) >> >> >> Regards, >> Shyam Pillai >> >> Image Importer Wizard: http://skp.mvps.org/iiw.htm >> >> >>> Shyamm, >>> >>> I had already tried that but it also fails with "following statement >>> fails with the error: 'Presentations (unknown member) : Invalid >>> request. The PowerPoint Frame window does not exist." if don't have >>> oPwrpnt.Activate included which causes the blank PPT screen to be >>> flashed. >>> >>> Vic >>> >>> "Shyam Pillai" <ShyamPillai(a)Gmail.com> wrote in message >>> news:e$RcSD00KHA.220(a)TK2MSFTNGP06.phx.gbl... >>> >>>> The Open method accepts 4 arguments. One of them is - WithWindow, set >>>> that to False. >>>> >>>> Regards, >>>> Shyam Pillai >>>> Handout Wizard: http://skp.mvps.org/how >>>> >>>> "Vic" <vic(a)showsec.com> wrote in message >>>> news:AEADBAFE-56D2-4025-B703-E47FCC04686A(a)microsoft.com... >>>> >>>>> Hello, >>>>> >>>>> I am trying to automate the creation of building the PPT file and I >>>>> want to hide the process. However, I can't seem to get rid of >>>>> having to activate the application object which cause a blank PPT >>>>> screen to flash. The "Unknown Member" seems to be what has to be >>>>> identified but how?? Following is the code with comments attached to >>>>> what I've tried. >>>>> >>>>> Thank you very much, Vic >>>>> >>>>> Set oPwrpnt = CreateObject("Powerpoint.application") >>>>> >>>>> ' oPwrpnt.Visible = False <<=== This fails Application >>>>> (unknown member) : Invalid request. Hiding the application window >>>>> is not >>>>> allowed. >>>>> oPwrpnt.Activate <<== will flash a blank PPT screen >>>>> 'oPwrpnt.WindowState = ppWindowMinimized <<== Fails if the >>>>> above is commented out >>>>> deffilename = App.Path & "\" & main.cboChartSelection & >>>>> "\MyTemplate.pptxm" >>>>> >>>>> 'following statement fails with the error: 'Presentations (unknown >>>>> member) : Invalid request. The PowerPoint Frame window does not >>>>> exist. ' if oPwrpnt.Activate is commented out >>>>> >>>>> Set OpwrPresent = oPwrpnt.Presentations.Open(deffilename).Slides(1) >>>>> >>>>> 'Also the following fails with the same error as above >>>>> Set OpwrPresent = oPwrpnt.Presentations.Open(deffilename, >>>>> False).Slides(1) >> >> >
From: Steve Rindsberg on 5 Apr 2010 15:42
> OK that said, I almost have this thing working as it has completed the > creation of the slide with multiple graphs from the database but now when I > try to save the final slide it says there is no active presentation > (Application (unknown member) : Invalid request. There is no active > presentation.). The statement to save is "oPwrpnt.ActivePresentation.SaveAs > (CGFF_PPTFileName)". Use oPwrpnt.SaveAs(CGFF_PPTFileName) By the way, if you have a reference set to PowerPoint in tools, references, Intellisense will pop up the available methods and properties when you type oPwrPnt. If it's not on the pop up list, it's incorrect, in most cases. ============================== PPT Frequently Asked Questions http://www.pptfaq.com/ PPTools add-ins for PowerPoint http://www.pptools.com/ |