PC Review


Reply
Thread Tools Rate Thread

Control a Table in Word From Excel

 
 
Simon
Guest
Posts: n/a
 
      6th Aug 2008
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 Eg
IncrementRotation -90 or wdAutoFitContent


I get a run time error 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




 
Reply With Quote
 
 
 
 
Ardus Petus
Guest
Posts: n/a
 
      6th Aug 2008
Probably a typo: yo types appword instead of appWrd

Cheers
--
AP

"Simon" <(E-Mail Removed)> a écrit dans le message de news:
DBEFE093-AEFB-48A1-8346-(E-Mail Removed)...
> 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
> Eg
> IncrementRotation -90 or wdAutoFitContent
>
>
> I get a run time error 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
>
>
>
>



 
Reply With Quote
 
Simon
Guest
Posts: n/a
 
      6th Aug 2008
Hi, thanks Ardus....you were correct....table works ok now.

However I'm still having trouble trying the control a 'picture' in word. I'm
using the following code:

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

I get a run time error on the third line. Any idea how I can rotate the
picture I have just pasted into word?


"Ardus Petus" wrote:

> Probably a typo: yo types appword instead of appWrd
>
> Cheers
> --
> AP
>
> "Simon" <(E-Mail Removed)> a écrit dans le message de news:
> DBEFE093-AEFB-48A1-8346-(E-Mail Removed)...
> > 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
> > Eg
> > IncrementRotation -90 or wdAutoFitContent
> >
> >
> > I get a run time error 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
> >
> >
> >
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 2007 - table, how to control line spacing Marianna2007 Microsoft Word Document Management 1 11th Sep 2009 09:18 PM
Can I put tab control on a table I created in word? CyberTaz Microsoft Word Document Management 2 16th Jan 2009 02:49 PM
Control of Numbering in a Word Table Gaijintendo Microsoft Word Document Management 1 22nd Dec 2008 04:47 PM
convet word table in to excel table? mani Microsoft Word Document Management 1 27th May 2008 02:51 PM
feeding a word table from an excel table musical Microsoft Excel Misc 1 23rd Apr 2004 12:29 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:52 AM.