Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General PowerPoint Questions / September 2006

Tip: Looking for answers? Try searching our database.

Embedded Word table objects change size in PowerPoint 2003

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JS - 11 Sep 2006 13:33 GMT
Hi All:

I'm been having some seriou troubles with PPT presentations that contain
embedded word objects (tables) for some time now.
I need to programmatically modify the contents of these tables (via a
Macro), but almost invariably the size/layout/configuration/etc. of these
tables are modified (stretched, shrunck, cropped, etc.).
I've scanned the Internet for articles on this and the closest I came to
was: http://support.microsoft.com/kb/249317/
but this is 2000 (I'm using PowerPoint/Word 2003 SP2).
Could someone please give me an idea of what to do?

Thanks so much, JS
Steve Rindsberg - 11 Sep 2006 21:21 GMT
> Hi All:
>
[quoted text clipped - 3 lines]
> Macro), but almost invariably the size/layout/configuration/etc. of these
> tables are modified (stretched, shrunck, cropped, etc.).

Can you explain in a bit more detail what you're up against?

It's not clear whether the problem is that the tables are getting modified as
the result of what you're doing programmatically, or that you're having to make
mods to the tables because they're already bunged.

Also, can you tell what type of tables they are?  Word or Excel tables embedded
in PPT or native PPT tables?

> I've scanned the Internet for articles on this and the closest I came to
> was: http://support.microsoft.com/kb/249317/
> but this is 2000 (I'm using PowerPoint/Word 2003 SP2).
> Could someone please give me an idea of what to do?
>
> Thanks so much, JS

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
JS - 13 Sep 2006 19:21 GMT
Hi Steve: Thanks for replying.
The tables are getting modified as the result of what I'm doing
programmatically, and they are all Word tables embedded in PPT.
Again, thanks for your imput. Rgds, JS

Here's the code I run on the Presentation:
============================
Sub EmbeddedWord_Replace_All_Ask()
Dim oSlide As Slide: Dim oShape As Shape: Dim oDoc As Word.Document
Dim SldNum, Indice, IndiceMax As Long: Dim celtxt, timeS, TimeF, tStart,
tEnd As String
Dim wdCoc, wdApp As Object: Dim FindText, ReplaceText As String
FindText = InputBox("Enter text to be found (to be replaced)")
ReplaceText = InputBox("Enter replacement text")
On Error Resume Next: NewWordOpened = False ' Set wdApp =
CreateObject("Word.Application")
Set wdApp = GetObject(, "Word.Application")
If wdApp Is Nothing Then
Set wdApp = CreateObject("Word.Application"): NewWordOpened = True
Else
MsgBox ("There is one or more instances of WORD open")
End If
On Error GoTo 0
For Each oSlide In ActivePresentation.Slides
     SldNum = SldNum + 1
     With oSlide
      For Each oShape In .Shapes
       If oShape.Type = msoEmbeddedOLEObject Then
        If oShape.OLEFormat.ProgID = "Word.Document.8" Then
         Set wdDoc = oShape.OLEFormat.Object
         wdDoc.Select
          timeS = Time
           With wdApp.Selection.Find
            .Text = FindText
            .ClearFormatting
            .Replacement.Text = ReplaceText
            .Replacement.ClearFormatting
            .Forward = True
            .Wrap = wdFindContinue
            .Format = False
            .MatchCase = True
            .MatchWholeWord = False
            .MatchWildcards = False
            .MatchSoundsLike = False
            .MatchAllWordForms = False
            .Execute Replace:=wdReplaceAll
           End With
          TimeF = Time
          wdDoc.Save
          wdApp.ActiveDocument.Close wdSaveChanges = False
        End If
      End If
     Next oShape
    End With
  Next oSlide
  If NewWordOpened Then wdApp.Quit
End Sub

> > Hi All:
> >
[quoted text clipped - 25 lines]
> PPTools:  www.pptools.com
> ================================================
Steve Rindsberg - 14 Sep 2006 02:03 GMT
> Hi Steve: Thanks for replying.
> The tables are getting modified as the result of what I'm doing
[quoted text clipped - 7 lines]
> Dim SldNum, Indice, IndiceMax As Long: Dim celtxt, timeS, TimeF, tStart,
> tEnd As String

It may or may not matter in this case but did you know that your variables are
not what you think they are?

When you do:
Dim This, That, TheOther as Long

it's equivalent to:
Dim This as Variant
Dim That as Variant
Dim TheOther as Long

> Dim wdCoc,

And should probably be wdDoc?  If the compiler isn't barking at you over stuff
like this, you might want to add

Option Explicit

at the top of the declarations section of each of your modules.  Let the
computer tell you when your fingers went off on their own and did something
silly.  ;-)

Beyond that it would seem to be mostly a Word problem; I'd post in
Public.Office.Developer.Automation about this.  But first, just before you do
WdApp.Quit add WdApp.Update

wdApp As Object: Dim FindText, ReplaceText As String
> FindText = InputBox("Enter text to be found (to be replaced)")
> ReplaceText = InputBox("Enter replacement text")
[quoted text clipped - 75 lines]
> > PPTools:  www.pptools.com
> > ================================================

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
JS - 14 Sep 2006 13:25 GMT
Hi Steve: Thanks so much for your reply.
Aaahhh... did not know about ...This, That,... being Variant!!! This
explains lots of other things :) [but unfortunately not this
problem...well... one thing at a time...]
Also, upon adding wdApp.update to "If NewWordOpened Then wdApp.Quit"
becoming [If NewWordOpened Then wdApp.Update: wdApp.Quit] I get barked at
with "Object doesn't support this property or method" (however, I did add
"wdDoc.Save" withing the find&replace loop in the code - is this the same
thing?)
I'll post this to the newsgroup you suggested and see what I get.
Steve, again, thanks for your inputs and time! They are valued!!
Rgds, JS

> > Hi Steve: Thanks for replying.
> > The tables are getting modified as the result of what I'm doing
[quoted text clipped - 120 lines]
> PPTools:  www.pptools.com
> ================================================
Steve Rindsberg - 14 Sep 2006 18:33 GMT
> Hi Steve: Thanks so much for your reply.
> Aaahhh... did not know about ...This, That,... being Variant!!! This
> explains lots of other things :) [but unfortunately not this
> problem...well... one thing at a time...]

Right ...not a problem in this case, but some weird little bugs can creep in
when you let VB "help" you with variables.  Best to lead it by the nose to
where you want it.  I see you've done that in the code you posted in the other
group, and that you and Cindy Meister have found one another.  Good ... she's
first-rate.

> Also, upon adding wdApp.update to "If NewWordOpened Then wdApp.Quit"
> becoming [If NewWordOpened Then wdApp.Update: wdApp.Quit] I get barked at
> with "Object doesn't support this property or method" (however, I did add
> "wdDoc.Save" withing the find&replace loop in the code - is this the same
> thing?)

Nuts.  I was hoping that'd be the answer ... it frequently is when you're
working with Graph objects in similar ways.

> I'll post this to the newsgroup you suggested and see what I get.
> Steve, again, thanks for your inputs and time! They are valued!!
[quoted text clipped - 133 lines]
> > PPTools:  www.pptools.com
> > ================================================

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Brian Reilly, MVP - 15 Sep 2006 16:02 GMT
JS,
try getting the .top, .left, .width and .heightas variables  before
you activate Word.
Then when you are done with Word set the shapes dimensions to those
variables.

Brian Reilly, MVP

>Hi All:
>
[quoted text clipped - 9 lines]
>
>Thanks so much, JS
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.