T
technoknight
I am into PowerPoint Automation and created plugins for PPT 2002 & 2003. Now,
I am trying to amend an exitsing plugin to make it work with PPT 2007.
I have created custom toolbars inside PowerPoint and on clicking them I am
calling functions from a dll file. In one part of the dll I have a function
which creates a copy of the existing one by doing a "SaveCopyAs" & then
opening up the copy using the Open method. The code is:
Public Sub ShowAnimatorDialogBox()
Public App_ As PowerPoint.Application
Dim sTempFile As String
Set App_ = CreateObject("PowerPoint.Application")
sTempFile = "c:\temp.ppt"
' save a copy of the original file
Call App_.ActivePresentation.SaveCopyAs(sTempFile)
' Open the copy
App_.Presentations.Open sTempFile, , False
End Sub
-----------------------------------------------------------------
Suppose, I have a 2 slide presentation with title & body text layout. Now, I
want to access some properties of
ActivePresentation.Slides(2).Shapes(1).TextFrame.TextRange. These properties
are BoundLeft, BoundWidth etc. Before making the copy of the existing PPT I
have right values. But, as soon as I create a copy all the properties under
ActivePresentation.Slides(2).Shapes(2).TextFrame.TextRange change to
<Application defined or Object Defined Error>.
When I do the same in the VBA part then it shows me the values but when I
execute this code in the dll then the values are not availble and, hence, I
encounter an Automation Error. This code works fine in the dll for PPT 2002 &
2003 but for 2007 it is failing.
Can anyone please help me by telling me what exactly is happening here? Why
the values changes to errors just when I make the copy? What can I do to get
rid of this error?
This is urgent. Thanks a lot in advance.
I am trying to amend an exitsing plugin to make it work with PPT 2007.
I have created custom toolbars inside PowerPoint and on clicking them I am
calling functions from a dll file. In one part of the dll I have a function
which creates a copy of the existing one by doing a "SaveCopyAs" & then
opening up the copy using the Open method. The code is:
Public Sub ShowAnimatorDialogBox()
Public App_ As PowerPoint.Application
Dim sTempFile As String
Set App_ = CreateObject("PowerPoint.Application")
sTempFile = "c:\temp.ppt"
' save a copy of the original file
Call App_.ActivePresentation.SaveCopyAs(sTempFile)
' Open the copy
App_.Presentations.Open sTempFile, , False
End Sub
-----------------------------------------------------------------
Suppose, I have a 2 slide presentation with title & body text layout. Now, I
want to access some properties of
ActivePresentation.Slides(2).Shapes(1).TextFrame.TextRange. These properties
are BoundLeft, BoundWidth etc. Before making the copy of the existing PPT I
have right values. But, as soon as I create a copy all the properties under
ActivePresentation.Slides(2).Shapes(2).TextFrame.TextRange change to
<Application defined or Object Defined Error>.
When I do the same in the VBA part then it shows me the values but when I
execute this code in the dll then the values are not availble and, hence, I
encounter an Automation Error. This code works fine in the dll for PPT 2002 &
2003 but for 2007 it is failing.
Can anyone please help me by telling me what exactly is happening here? Why
the values changes to errors just when I make the copy? What can I do to get
rid of this error?
This is urgent. Thanks a lot in advance.