dhancy
Board Regular
- Joined
- Jul 10, 2013
- Messages
- 123
- Office Version
- 365
- Platform
- Windows
Hello,
Using Excel VBA, I am trying to adjust the column widths of a table I created in Word. I have tried many variations of this, but I still cannot get this formatted correctly. Here is a snippet of the code I currently have:
With this particular version, the resulting table shows three columns, each of which has the same column width. I have tried wdPreferredWidthPoints as well, but that also does not display correctly.
Can you let me know if I am missing something? Perhaps there is a parameter I can add/change on the first line when I create the table? Perhaps there is another column attribute I can use besides PreferredWidth?
Any hints you can provide to help me correct this are greatly appreciated. Thank you!!!
Dennis
Using Excel VBA, I am trying to adjust the column widths of a table I created in Word. I have tried many variations of this, but I still cannot get this formatted correctly. Here is a snippet of the code I currently have:
VBA Code:
wrdDoc.Tables.Add Range:=.Range, NumRows:=4, NumColumns:=3, DefaultTableBehavior:=0
With wrdDoc.Tables(wrdDoc.Tables.Count)
.Columns.PreferredWidthType = wdPreferredWidthPercent
.Columns(1).PreferredWidth = 10
.Columns(2).PreferredWidth = 20
End With
With this particular version, the resulting table shows three columns, each of which has the same column width. I have tried wdPreferredWidthPoints as well, but that also does not display correctly.
Can you let me know if I am missing something? Perhaps there is a parameter I can add/change on the first line when I create the table? Perhaps there is another column attribute I can use besides PreferredWidth?
Any hints you can provide to help me correct this are greatly appreciated. Thank you!!!
Dennis