Embedded Word table objects change size in PowerPoint 2003

J

JS

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
 
J

JS

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
 
J

JS

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
 
B

Brian Reilly, MVP

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top