Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Word using a macro

Status
Not open for further replies.

bcoates

Programmer
Feb 21, 2006
29
US
I am writing a macro in Word 2003 I am outputting a picture and then putting a table after it. How do i put a space between the picture and the table? Code Snippet below.


'Outputting the picture
set objshape = ThisDocument.shapes
objshape.AddPicture

'Between this picture and the table i need a space
'it is currently outputtting them on top of each other

'Setting up table
Set objrange = ThisDocument.Range
ThisDocument.Tables.Add objrange, 1, 2
set objtable = ThisDocument.Tables(1)
...
 



Hi,

Turn on your macro recorder and record doing what you want to do.

Skip,
[sub]
[glasses] [red][/red]
[tongue][/sub]
 
I cant do that because im pulling the picture and the data to go in the table from a different program.
 



Doesn't amtter WHERE the object comes FROM.

It does matter what happens in WORD after it's there.

Skip,
[sub]
[glasses] [red][/red]
[tongue][/sub]
 
This is a bit of odd code. However, to put a space between the picture and the table...ummmm, put a space. As Skip suggest, you can get the code doing that easy enough by recording a macro.

However, I would like to point out that even if you DID add a space (no doubt one of the "extra" paragraphs I hate so much), it still won't work.

Your use of object is odd, in particular objrange. Think about what it is you Set it as. I fail to see why you even need it - or objshape either. In any case, objrange is Set as the entire document, then used to add a table for that range. Does that not.....ummmm, include the picture you just inserted? Yup.

faq219-2884

Gerry
My paintings and sculpture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top