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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

format word table exported from excel

Status
Not open for further replies.

gremlins

Programmer
Jul 20, 2003
20
GB
I have some excel vba that produces different types of reports from a form. One of the options is to export the data to word. In order to do this I copy the part of the spreadsheet and paste it into word using the following code:

Set wordobj = CreateObject("Word.Application")
With wordobj
...
Worksheets("chartdata").Select
Worksheets("chartdata").Range("A1:G19").Select
Selection.Copy
ActiveWindow.WindowState = xlNormal
ActiveWindow.WindowState = xlMaximized
.typeparagraph
.typeparagraph
.ParagraphFormat.Alignment = 0
.Paste

the problem is that the table spills over the right hand side of the page. I need to move the table to the left slightly so that all the cells fit on the page. Is there any way to either change the word page indents or select the table and move it?

Cheers
 
...or

insert a section break-next page

change the page orientation to landscape

insert the excel table

insert a section break-next page

change the page orientation to portrait.

Skip,

[red]Be advised:[/red] [glasses]
Alcohol and Calculus do not mix!
If you drink, don't derive! [tongue]
 
insert a section break-next page

change the page orientation to landscape

insert the excel table

insert a section break-next page

change the page orientation to portrait.



and how is that done? also how to remove that break afterwords?
 
Hi Gremlins,

Using the macro recorder to move the table to 1cm left of the left margin returns the following line of code:
Selection.Tables(1).Rows.LeftIndent = CentimetersToPoints(-1)
Try using that as your starting point.

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top