View Full Version : Inserting Table into word from Excel VBA
Hi,
How would i do this i've tried this but it displays a 'Wrong Number of arguments error'
Code:
.ActiveDocument.Tables.Add NumRows:=2, NumColumns:= _ 2, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _ wdAutoFitFixed
Thanks
lucas
04-25-2007, 10:30 AM
Hi jonn,
You might try looking in word vba on how to create your table and then try it from excel. An example from the word help file:
Selection.Collapse Direction:=wdCollapseStart
Set myTable = ActiveDocument.Tables.Add(Range:=Selection.Range, _
NumRows:=5, NumColumns:=5)
myTable.AutoFormat Format:=wdTableFormatClassic2
fumei
04-27-2007, 08:02 PM
This is a simple syntax error. Look closely.
.ActiveDocument.Tables.Add NumRows:=2, NumColumns:= _ 2, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _ wdAutoFitFixed
.ActiveDocument.Tables.Add NumRows:=2, NumColumns:=2, _
DefaultTableBehavior:=wdWord9TableBehavior, _
AutoFitBehavior:=wdAutoFitFixedYour underscore characters are in the wrong place. The one before wdAutoFitFixed should not be there at all.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.