controlling MS Word from Excel

JPL007

New member
Joined
Oct 29, 2012
Messages
3
Reaction score
0
Points
0
Hi all
thank you for reading this.

I am trying to write a macro to control a Word document (wrdDoc) from Excel VBA. However the syntax is quite different between them.

The first line is working, I cannot get the right syntax for the rest.
Any help please ?
cheers
Julien

[VBA]Sub createTableUnderlying(nbUnderlyings, leUnd)
'Go to Fund Ticker


wrdDoc.bookmarks("FundTicker").Select
With Selection.Cells
.Split NumRows:=nbUnderlyings, NumColumns:=4, MergeBeforeSplit:=False
End With

'Need to select table
wrdDoc.bookmarks("FundTicker").Select
wrdDoc.Selection.MoveDown Unit:=wdLine, Count:=nbUnderlyings, Extend:=wdExtend
wrdDoc.Selection.MoveRight Unit:=wdCharacter, Count:=3, Extend:=wdExtend
wrdDoc.Selection.SelectCell
wrdDoc.Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
wrdDoc.Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter
With Selection.Cells
With .Borders(wdBorderTop)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderBottom)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderHorizontal)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderVertical)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
End With
' With Options
' .DefaultBorderLineStyle = wdLineStyleSingle
' .DefaultBorderLineWidth = wdLineWidth050pt
' .DefaultBorderColor = wdColorAutomatic
' End With

End Sub[/VBA]
 
Last edited:

JPL007

New member
Joined
Oct 29, 2012
Messages
3
Reaction score
0
Points
0
I particularly need help with

With Selection.Cells
.Split NumRows:=nbUnderlyings, NumColumns:=4, MergeBeforeSplit:=False
End With

Thank you
 
Top