Re: Macros
Hello everyone
I was wondering if it is possible to create a table with specified
dimensions in a Word macro.
I would like to create a macro in Word with a table set up for side headings
(the first column at 1.5 inches). When I record the macro, I can insert a
table, but I can't seem to size it correctly.
Any suggestions?
Based on the requirements: create table whose first column is 1.5
inches wide: this seems to work for me, maybe it'll do what you want.
I recorded it, then edited the code a bit. BTW, I tested this in Word
2000; later versions may exhibit different behaviour.
Sub MakeTable()
'
' MakeTable Macro
' Macro recorded 10/27/2006 by Edgar D'Souza
'
Dim tblNew As Word.Table
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=2, NumColumns:= _
2, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitWindow
Set tblNew = Selection.Tables(1)
tblNew.Columns(1).PreferredWidthType = wdPreferredWidthPoints
tblNew.Columns(1).PreferredWidth = InchesToPoints(1.5)
'Remove all borders
With tblNew
.Borders(wdBorderTop).LineStyle = wdLineStyleNone
.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
.Borders(wdBorderRight).LineStyle = wdLineStyleNone
.Borders(wdBorderHorizontal).LineStyle = wdLineStyleNone
.Borders(wdBorderVertical).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
End With
End Sub
HTH
Ed.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
WebWorks ePublisher Pro for Word features support for every major Help format plus PDF, HTML and more. Flexible, precise, and efficient content delivery. Try it today! http://www.webworks.com/techwr-l
Easily create HTML or Microsoft Word content and convert to any popular Help file format or printed documentation. Learn more at http://www.DocToHelp.com/TechwrlList
---
You are currently subscribed to TECHWR-L as archive -at- infoinfocus -dot- com -dot-
To unsubscribe send a blank email to techwr-l-unsubscribe -at- lists -dot- techwr-l -dot- com
or visit http://lists.techwr-l.com/mailman/options/techwr-l/archive%40infoinfocus.com
To subscribe, send a blank email to techwr-l-join -at- lists -dot- techwr-l -dot- com
Send administrative questions to admin -at- techwr-l -dot- com -dot- Visit
http://www.techwr-l.com/techwhirl/ for more resources and info.
Follow-Ups:
- Re: Macros, Holly Steele
References:
Macros: From: Holly Steele
Previous by Author:
Re: graying out part of a graphic
Next by Author:
Re: Macros
Previous by Thread:
Macros
Next by Thread:
Re: Macros
Search our Technical Writing Archives & Magazine
Visit TechWhirl's Other Sites
Sponsored Ads