Controling Tables

S

Simon

Hi, I use code that sends a range of excel tables to bookmarks in word. It
all works well (I have modified the following code if curious
http://www.vbaexpress.com/kb/getarticle.php?kb_id=133 )

Once a table or picture is sent to word, I'd like to be able to format it
from excel (ie flip it 90 degrees or auto fit the table to contents


I get a run time error from excel on the 3rd line of the following code:

appWrd.Selection.PasteSpecial DataType:=wdPasteRTF, Placement:=wdInLine
appWrd.Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
appword.Selection.Tables(1).AutoFitBehavior (wdAutoFitContent)

I've tried a few ways of trying to pick up the table i've just created in
word, but struggling.

Any help would be appreciated.

Regards
Simon

(Cross posted in excel.vba ..... sorry if this is not allowed, but just
didnt know if this was excel or word related).
 
S

Simon

Hi Jonathan, Thanks, just picked that up.

however I'm struggling with trying to control a picture....getting a run
time error on the third line of the following code. any ideas?

appWrd.Selection.PasteSpecial DataType:=wdPasteEnhancedMetafile,
Placement:=wdInLine
appWrd.Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
appWrd.Selection.Shape(1).ShapeRange.IncrementRotation -90
 
J

Jonathan West

Simon said:
Hi Jonathan, Thanks, just picked that up.

however I'm struggling with trying to control a picture....getting a run
time error on the third line of the following code. any ideas?

appWrd.Selection.PasteSpecial DataType:=wdPasteEnhancedMetafile,
Placement:=wdInLine
appWrd.Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
appWrd.Selection.Shape(1).ShapeRange.IncrementRotation -90

This line is wrong

appWrd.Selection.Shape(1).ShapeRange.IncrementRotation -90

Should be this

appWrd.Selection.ShapeRange(1).IncrementRotation -90
 

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