View Single Post
 
Old 12-22-2011, 11:26 PM
tinfanide tinfanide is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Hi tinfanide,

As mentioned in my last post:

Thus, for the line:
.Borders(wdBorderTop).LineStyle = wdLineStyleSingle
you need to look at both the 'WdBorderType Enumeration' and the 'WdLineStyle Enumeration' in the Word vba Help file, and subsitute the numeric values for the Word names.

You'd probably find the conversion to late binding less painful if you were to create a new Word document with just the Word portion of your code in it as a test sub, then step through the code, identifying the numeric values that go with each of the Word-specific parameters in your code.
Sorry, I still don't understand what numeric values and Word names are.
The refs I'm reading:
http://msdn.microsoft.com/en-us/libr...ice.12%29.aspx
http://msdn.microsoft.com/en-us/libr...ice.12%29.aspx

Code:
Sub setTableBorders()
 
Dim wrdApp As Object
Set wrdApp = CreateObject("Word.Application")
Dim wrdDoc As Object
Set wrdDoc = wrdApp.documents.Add
wrdApp.Visible = True
 
' Dim wrdTbl As Table doesn't work in Excel VBA
Dim wrdTbl As Object
Set wrdTbl = wrdDoc.Tables.Add(Range:=wrdDoc.Range, _
NumRows:=4, _
NumColumns:=1)
  
With wrdTbl
For r = 1 To 4
    .Cell(r, 1).Range.Text = ActiveSheet.Cells(r, 1).Value
Next r

''''''''''''
.wdBorderTop.wdLineStyle = 1
''''''''''''

End With
End Sub
Reply With Quote