Re: Macro for table problems
- From: "John McGhie [MVP - Word and Word Macintosh]" <john@xxxxxxxxxxx>
- Date: Tue, 10 Oct 2006 21:24:41 +1000
If you pasted directly from your browser into the Visual Basic Editor, it
would convert the "spaces" into "non-breaking spaces". These are different
characters: a non-breaking space is significant in VBA.
To fix that, paste the code into SimpleText, save as Text Only, re-open it,
and paste from there. Then, any line that turns red has been folded over.
Delete the line-ender at the end of the first red line until it joins the
line below it. That should fix it.
Let me do that bit for you: There's a little attachment on this post. Save
it to your hard drive. In the VBA Editor, go to the Insert menu, choose
"File" and select this file. It will import into the Visual Basic Editor
correctly for you.
And no, you are not dumb: but that's a fairly advanced piece of code. Not
recommended for your first venture into VBA :-)
Now, do what Clive says: it's a LOT easier :-)
Cheers
On 9/10/06 11:43 PM, in article
1160401438.567270.98440@xxxxxxxxxxxxxxxxxxxxxxxxxxxx, "john@xxxxxxxxxxxxx"
<john@xxxxxxxxxxxxx> wrote:
Hi John
Maybe I'm dumb, but I didn't understand what that progamming language
meant or why the macro does not work.
But if it doesn't work, then what is the best way to insert a specific
table format that I use repeatedly?
John
John McGhie [MVP - Word and Word Macintosh] wrote:
Hi John:
You do NOT want to do the macro! Here's why... (Yes, it works :-))
Sub Main()
'
' Insert or Format Table Macro
' Macro recorded 14/03/00 by John McGhie
'
' On Error GoTo Error
Dim astyle As Style
Dim aDoc As String
Dim aTemplate As String
Dim x As Integer
Dim TabBodyText As Style
Dim TabHeading As Style
Dim TabBullet As Style
Dim tabNumber As Style
aTemplate = ActiveDocument.AttachedTemplate.FullName
aDoc = ActiveDocument.FullName
For Each astyle In ActiveDocument.Styles
If UCase(astyle.NameLocal) = UCase("Table Body Text") Then Set
TabBodyText = astyle
If UCase(astyle.NameLocal) = UCase("Table Bullet") Then Set TabBullet =
astyle
If UCase(astyle.NameLocal) = UCase("Table Heading") Then Set TabHeading
= astyle
If UCase(astyle.NameLocal) = UCase("Table Number") Then Set tabNumber =
astyle
Next astyle
If TabBodyText Is Nothing Then
ActiveDocument.Styles.Add Name:="Table Body Text"
Set TabBodyText = ActiveDocument.Styles("Table Body Text")
With TabBodyText
.AutomaticallyUpdate = False
.BaseStyle = "Body Text"
.NextParagraphStyle = "Table Body Text"
End With
With TabBodyText.Font
.Name = BodyFont
.Size = 10
.Bold = False
.Italic = False
End With
With TabBodyText.ParagraphFormat
.LeftIndent = 0
.RightIndent = 0
.SpaceBefore = 2
.SpaceBeforeAuto = False
.SpaceAfter = 2
.SpaceAfterAuto = False
.LineSpacingRule = wdLineSpaceSingle
.Alignment = wdAlignParagraphLeft
.WidowControl = False
.KeepWithNext = False
.KeepTogether = True
.PageBreakBefore = False
.FirstLineIndent = 0
.OutlineLevel = wdOutlineLevelBodyText
End With
End If
If TabHeading Is Nothing Then
ActiveDocument.Styles.Add Name:="Table Heading"
Set TabHeading = ActiveDocument.Styles("Table Heading")
With TabHeading
.AutomaticallyUpdate = False
.BaseStyle = "Table Body Text"
.NextParagraphStyle = "Table Heading"
End With
With TabHeading.Font
.Name = HeadingFont
.Size = 10
.Bold = True
.Italic = False
End With
With TabHeading.ParagraphFormat
.LeftIndent = 0
.RightIndent = 0
.SpaceBefore = 2
.SpaceBeforeAuto = False
.SpaceAfter = 2
.SpaceAfterAuto = False
.LineSpacingRule = wdLineSpaceSingle
.Alignment = wdAlignParagraphLeft
.WidowControl = False
.KeepWithNext = True
.KeepTogether = True
.PageBreakBefore = False
.FirstLineIndent = 0
.OutlineLevel = wdOutlineLevelBodyText
End With
End If
If TabBullet Is Nothing Then
ActiveDocument.Styles.Add Name:="Table Bullet"
Set TabBullet = ActiveDocument.Styles("Table Bullet")
With TabBullet
.AutomaticallyUpdate = False
.BaseStyle = "Table Body Text"
.NextParagraphStyle = "Table Bullet"
End With
With TabBullet.Font
.Name = BodyFont
.Size = 10
.Bold = False
.Italic = False
End With
With TabBullet.ParagraphFormat
.LeftIndent = 22
.RightIndent = 0
.SpaceBefore = 0
.SpaceBeforeAuto = False
.SpaceAfter = 5
.SpaceAfterAuto = False
.LineSpacingRule = wdLineSpaceSingle
.Alignment = wdAlignParagraphLeft
.WidowControl = True
.KeepWithNext = False
.KeepTogether = False
.PageBreakBefore = False
.FirstLineIndent = -17
.OutlineLevel = wdOutlineLevelBodyText
End With
TabBullet.ParagraphFormat.TabStops.ClearAll
TabBullet.ParagraphFormat.TabStops.Add _
Position:=22, Alignment:=wdAlignTabLeft, Leader:= _
wdTabLeaderSpaces
With ListGalleries(wdBulletGallery).ListTemplates(7).ListLevels(1)
.NumberFormat = ChrW(61623)
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleBullet
.NumberPosition = 6
.Alignment = wdListLevelAlignLeft
.TextPosition = 22
.TabPosition = 22
.ResetOnHigher = 0
.StartAt = 1
.Font.Name = "Symbol"
.LinkedStyle = "Table Bullet"
End With
End If
If tabNumber Is Nothing Then
ActiveDocument.Styles.Add Name:="Table Number"
Set tabNumber = ActiveDocument.Styles("Table Number")
With tabNumber
.AutomaticallyUpdate = False
.BaseStyle = "Table Bullet"
.NextParagraphStyle = "Table Number"
End With
With tabNumber.Font
.Name = BodyFont
.Size = 10
.Bold = False
.Italic = False
End With
With tabNumber.ParagraphFormat
.LeftIndent = 22
.RightIndent = 0
.SpaceBefore = 0
.SpaceBeforeAuto = False
.SpaceAfter = 2
.SpaceAfterAuto = False
.LineSpacingRule = wdLineSpaceSingle
.Alignment = wdAlignParagraphLeft
.WidowControl = True
.KeepWithNext = False
.KeepTogether = False
.PageBreakBefore = False
.FirstLineIndent = -17
.OutlineLevel = wdOutlineLevelBodyText
End With
tabNumber.ParagraphFormat.TabStops.ClearAll
tabNumber.ParagraphFormat.TabStops.Add _
Position:=22, Alignment:=wdAlignTabLeft, Leader:= _
wdTabLeaderSpaces
With ListGalleries(wdNumberGallery).ListTemplates(7).ListLevels(1)
.NumberFormat = "%1."
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = 6
.Alignment = wdListLevelAlignLeft
.TextPosition = 22
.TabPosition = 22
.ResetOnHigher = 0
.StartAt = 1
.LinkedStyle = "Table Number"
End With
End If
If Not Selection.Information(wdWithInTable) Then
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=5,
NumColumns:= _
3, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed
End If
Dim aTable As Table
Set aTable = Selection.Tables(1)
aTable.Select
aTable.AutoFormat Format:=wdTableFormatGrid5, ApplyBorders:= _
True, ApplyShading:=True, ApplyFont:=False, ApplyColor:=False, _
ApplyHeadingRows:=True, ApplyLastRow:=False,
ApplyFirstColumn:=False, _
ApplyLastColumn:=False, AutoFit:=True
aTable.Select
With Selection
.Rows.AllowBreakAcrossPages = False
.Paragraphs.Reset
.Font.Reset
.Style = ActiveDocument.Styles("Table Body Text")
With .Borders(wdBorderLeft)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth075pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderRight)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth075pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderTop)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth075pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderBottom)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth075pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderHorizontal)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth025pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderVertical)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth025pt
.Color = wdColorAutomatic
End With
.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
.Borders.Shadow = False
End With
With Options
.DefaultBorderLineStyle = wdLineStyleSingle
.DefaultBorderLineWidth = wdLineWidth025pt
.DefaultBorderColor = wdColorAutomatic
End With
aTable.Rows(1).Select
With Selection
.Style = ActiveDocument.Styles("Table Heading")
.Rows(1).HeadingFormat = True
With .Shading
.Texture = wdTexture10Percent
.ForegroundPatternColor = wdColorAutomatic
.BackgroundPatternColor = wdColorAutomatic
End With
End With
aTable.AutoFitBehavior (wdAutoFitWindow)
End
Error:
MsgBox "The Template has been damaged. See Tech Support.", vbCritical
End Sub
On 9/10/06 4:37 AM, in article
1160332667.937426.263970@xxxxxxxxxxxxxxxxxxxxxxxxxxxx, "john@xxxxxxxxxxxxx"
<john@xxxxxxxxxxxxx> wrote:
Hi Beth
No. I wasn't seeing grey lines, but solid black ones that printed.
But I'll try AutoCorrect instead.
Many thanks
John
Beth Rosengard wrote:
Hi John,
I always use AutoCorrect instead of AutoText for these things (habit). I
just tried it with a table that had no borders at all and with bold in just
one cell. It reproduces fine.
I don't know why AutoText isn't working for you but try AutoCorrect and see
if it makes a difference.
By the way, when you get rid of table borders, they turn gray; they don't
actually disappear (except when you print). Could that be what you're
seeing?
--
***Please always reply to the newsgroup!***
Beth Rosengard
MacOffice MVP
Mac Word FAQ: <http://word.mvps.org/Mac/WordMacHome.html>
My Site: <http://www.bethrosengard.com>
On 10/8/06 8:18 AM, in article
1160320690.065921.236980@xxxxxxxxxxxxxxxxxxxxxxxxxxx, "john@xxxxxxxxxxxxx"
<john@xxxxxxxxxxxxx> wrote:
Thanks, Dailya. The reason I tried a macro (which MIcrosoft Support
recommended) was that I'd alrady tried Autotext. When I used this, it
produced borders although the table I'd selected had none, and (if I
remember correctly) it didn't have bold in one column as did the
selected table.
John
--
Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.
John McGhie <john@xxxxxxxxxxx>
Microsoft MVP, Word and Word for Macintosh. Business Analyst, Consultant
Technical Writer.
Sydney, Australia +61 (0) 4 1209 1410
--B_3243265427_15662445
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
X-Google-AttachSize: 21194
<HTML>
<HEAD>
<TITLE>Re: Macro for table problems</TITLE>
</HEAD>
<BODY>
<FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:10.0px'>Hi
Jo=
hn:<BR>
<BR>
You do NOT want to do the macro! Here's why... (Yes, it works :=
-))<BR>
<BR>
Sub Main()<BR>
'<BR>
' Insert or Format Table Macro<BR>
' Macro recorded 14/03/00 by John McGhie<BR>
'<BR>
' On Error GoTo Error<BR>
<BR>
Dim astyle As Style<BR>
Dim aDoc As String<BR>
Dim aTemplate As String<BR>
Dim x As Integer<BR>
Dim TabBodyText As Style<BR>
Dim TabHeading As Style<BR>
Dim TabBullet As Style<BR>
Dim tabNumber As Style<BR>
<BR>
<BR>
aTemplate =3D ActiveDocument.AttachedTemplate.FullName<BR>
aDoc =3D ActiveDocument.FullName<BR>
For Each astyle In ActiveDocument.Styles<BR>
If UCase(astyle.NameLocal) =3D UCase("Table
Body=
Text") Then Set TabBodyText =3D astyle<BR>
If UCase(astyle.NameLocal) =3D UCase("Table
Bull=
et") Then Set TabBullet =3D astyle<BR>
If UCase(astyle.NameLocal) =3D UCase("Table
Head=
ing") Then Set TabHeading =3D astyle<BR>
If UCase(astyle.NameLocal) =3D UCase("Table
Numb=
er") Then Set tabNumber =3D astyle<BR>
Next astyle<BR>
<BR>
If TabBodyText Is Nothing Then<BR>
ActiveDocument.Styles.Add Name:=3D"Table Body
Te=
xt"<BR>
Set TabBodyText =3D
ActiveDocument.Styles("Table=
Body Text")<BR>
With TabBodyText<BR>
.AutomaticallyUpdate =3D
Fals=
e<BR>
.BaseStyle =3D "Body
Tex=
t"<BR>
.NextParagraphStyle =3D
"=
;Table Body Text"<BR>
End With<BR>
With TabBodyText.Font<BR>
.Name =3D BodyFont<BR>
.Size =3D 10<BR>
.Bold =3D False<BR>
.Italic =3D False<BR>
End With<BR>
With TabBodyText.ParagraphFormat<BR>
.LeftIndent =3D 0<BR>
.RightIndent =3D 0<BR>
.SpaceBefore =3D 2<BR>
.SpaceBeforeAuto =3D
False<BR=
.SpaceAfter =3D 2<BR>
.SpaceAfterAuto =3D False<BR>
.LineSpacingRule =3D
wdLineSp=
aceSingle<BR>
.Alignment =3D
wdAlignParagra=
phLeft<BR>
.WidowControl =3D False<BR>
.KeepWithNext =3D False<BR>
.KeepTogether =3D True<BR>
.PageBreakBefore =3D
False<BR=
.FirstLineIndent =3D 0<BR>
.OutlineLevel =3D
wdOutlineLe=
velBodyText<BR>
End With<BR>
End If<BR>
<BR>
If TabHeading Is Nothing Then<BR>
ActiveDocument.Styles.Add Name:=3D"Table
Heading=
"<BR>
Set TabHeading =3D ActiveDocument.Styles("Table
=
Heading")<BR>
With TabHeading<BR>
.AutomaticallyUpdate =3D
Fals=
e<BR>
.BaseStyle =3D "Table
Bo=
dy Text"<BR>
.NextParagraphStyle =3D
"=
;Table Heading"<BR>
End With<BR>
With TabHeading.Font<BR>
.Name =3D HeadingFont<BR>
.Size =3D 10<BR>
.Bold =3D True<BR>
.Italic =3D False<BR>
End With<BR>
With TabHeading.ParagraphFormat<BR>
.LeftIndent =3D 0<BR>
.RightIndent =3D 0<BR>
.SpaceBefore =3D 2<BR>
.SpaceBeforeAuto =3D
False<BR=
.SpaceAfter =3D 2<BR>
.SpaceAfterAuto =3D False<BR>
.LineSpacingRule =3D
wdLineSp=
aceSingle<BR>
.Alignment =3D
wdAlignParagra=
phLeft<BR>
.WidowControl =3D False<BR>
.KeepWithNext =3D True<BR>
.KeepTogether =3D True<BR>
.PageBreakBefore =3D
False<BR=
.FirstLineIndent =3D 0<BR>
.OutlineLevel =3D
wdOutlineLe=
velBodyText<BR>
End With<BR>
End If<BR>
<BR>
If TabBullet Is Nothing Then<BR>
ActiveDocument.Styles.Add Name:=3D"Table
Bullet&=
quot;<BR>
Set TabBullet =3D ActiveDocument.Styles("Table
B=
ullet")<BR>
With TabBullet<BR>
.AutomaticallyUpdate =3D
Fals=
e<BR>
.BaseStyle =3D "Table
Bo=
dy Text"<BR>
.NextParagraphStyle =3D
"=
;Table Bullet"<BR>
End With<BR>
With TabBullet.Font<BR>
.Name =3D BodyFont<BR>
.Size =3D 10<BR>
.Bold =3D False<BR>
.Italic =3D False<BR>
End With<BR>
With TabBullet.ParagraphFormat<BR>
.LeftIndent =3D 22<BR>
.RightIndent =3D 0<BR>
.SpaceBefore =3D 0<BR>
.SpaceBeforeAuto =3D
False<BR=
.SpaceAfter =3D 5<BR>
.SpaceAfterAuto =3D False<BR>
.LineSpacingRule =3D
wdLineSp=
aceSingle<BR>
.Alignment =3D
wdAlignParagra=
phLeft<BR>
.WidowControl =3D True<BR>
.KeepWithNext =3D False<BR>
.KeepTogether =3D False<BR>
.PageBreakBefore =3D
False<BR=
.FirstLineIndent =3D -17<BR>
.OutlineLevel =3D
wdOutlineLe=
velBodyText<BR>
End With<BR>
TabBullet.ParagraphFormat.TabStops.ClearAll<BR>
TabBullet.ParagraphFormat.TabStops.Add _<BR>
Position:=3D22,
Alignment:=3Dwd=
AlignTabLeft, Leader:=3D _<BR>
wdTabLeaderSpaces<BR>
With ListGalleries(wdBulletGallery).ListTemplates(7=
).ListLevels(1)<BR>
.NumberFormat =3D
ChrW(61623)=
<BR>
.TrailingCharacter =3D
wdTrai=
lingTab<BR>
.NumberStyle =3D
wdListNumber=
StyleBullet<BR>
.NumberPosition =3D 6<BR>
.Alignment =3D
wdListLevelAli=
gnLeft<BR>
.TextPosition =3D 22<BR>
.TabPosition =3D 22<BR>
.ResetOnHigher =3D 0<BR>
.StartAt =3D 1<BR>
.Font.Name =3D
"Symbol&q=
uot;<BR>
.LinkedStyle =3D "Table
=
Bullet"<BR>
End With<BR>
End If<BR>
<BR>
If tabNumber Is Nothing Then<BR>
ActiveDocument.Styles.Add Name:=3D"Table
Number&=
quot;<BR>
Set tabNumber =3D ActiveDocument.Styles("Table
N=
umber")<BR>
<BR>
With tabNumber<BR>
.AutomaticallyUpdate =3D
Fals=
e<BR>
.BaseStyle =3D "Table
Bu=
llet"<BR>
.NextParagraphStyle =3D
"=
;Table Number"<BR>
End With<BR>
With tabNumber.Font<BR>
.Name =3D BodyFont<BR>
.Size =3D 10<BR>
.Bold =3D False<BR>
.Italic =3D False<BR>
End With<BR>
With tabNumber.ParagraphFormat<BR>
.LeftIndent =3D 22<BR>
.RightIndent =3D 0<BR>
.SpaceBefore =3D 0<BR>
.SpaceBeforeAuto =3D
False<BR=
.SpaceAfter =3D 2<BR>
.SpaceAfterAuto =3D False<BR>
.LineSpacingRule =3D
wdLineSp=
aceSingle<BR>
.Alignment =3D
wdAlignParagra=
phLeft<BR>
.WidowControl =3D True<BR>
.KeepWithNext =3D False<BR>
.KeepTogether =3D False<BR>
.PageBreakBefore =3D
False<BR=
.FirstLineIndent =3D -17<BR>
.OutlineLevel =3D
wdOutlineLe=
velBodyText<BR>
End With<BR>
tabNumber.ParagraphFormat.TabStops.ClearAll<BR>
tabNumber.ParagraphFormat.TabStops.Add _<BR>
Position:=3D22,
Alignment:=3Dwd=
AlignTabLeft, Leader:=3D _<BR>
wdTabLeaderSpaces<BR>
With ListGalleries(wdNumberGallery).ListTemplates(7=
).ListLevels(1)<BR>
.NumberFormat =3D
"%1.&q=
uot;<BR>
.TrailingCharacter =3D
wdTrai=
lingTab<BR>
.NumberStyle =3D
wdListNumber=
StyleArabic<BR>
.NumberPosition =3D 6<BR>
.Alignment =3D
wdListLevelAli=
gnLeft<BR>
.TextPosition =3D 22<BR>
.TabPosition =3D 22<BR>
.ResetOnHigher =3D 0<BR>
.StartAt =3D 1<BR>
.LinkedStyle =3D "Table
=
Number"<BR>
End With<BR>
End If<BR>
<BR>
If Not Selection.Information(wdWithInTable) Then<BR>
ActiveDocument.Tables.Add Range:=3DSelection.Range,
N=
umRows:=3D5, NumColumns:=3D _<BR>
3,
DefaultTableBehavior:=3Dwd=
Word9TableBehavior, AutoFitBehavior:=3D _<BR>
wdAutoFitFixed<BR>
End If<BR>
<BR>
Dim aTable As Table<BR>
Set aTable =3D Selection.Tables(1)<BR>
<BR>
aTable.Select<BR>
aTable.AutoFormat Format:=3DwdTableFormatGrid5,
Apply=
Borders:=3D _<BR>
True, ApplyShading:=3DTrue,
A=
pplyFont:=3DFalse, ApplyColor:=3DFalse, _<BR>
ApplyHeadingRows:=3DTrue,
App=
lyLastRow:=3DFalse, ApplyFirstColumn:=3DFalse, _<BR>
ApplyLastColumn:=3DFalse,
Aut=
oFit:=3DTrue<BR>
<BR>
aTable.Select<BR>
<BR>
With Selection<BR>
.Rows.AllowBreakAcrossPages=
=3D False<BR>
.Paragraphs.Reset<BR>
.Font.Reset<BR>
.Style =3D
ActiveDocument.Sty=
les("Table Body Text")<BR>
With .Borders(wdBorderLeft)=
<BR>
.Li=
neStyle =3D wdLineStyleSingle<BR>
.Li=
neWidth =3D wdLineWidth075pt<BR>
.Co=
lor =3D wdColorAutomatic<BR>
End With<BR>
With .Borders(wdBorderRight=
)<BR>
.Li=
neStyle =3D wdLineStyleSingle<BR>
.Li=
neWidth =3D wdLineWidth075pt<BR>
.Co=
lor =3D wdColorAutomatic<BR>
End With<BR>
With .Borders(wdBorderTop)<=
BR>
.Li=
neStyle =3D wdLineStyleSingle<BR>
.Li=
neWidth =3D wdLineWidth075pt<BR>
.Co=
lor =3D wdColorAutomatic<BR>
End With<BR>
With .Borders(wdBorderBotto=
m)<BR>
.Li=
neStyle =3D wdLineStyleSingle<BR>
.Li=
neWidth =3D wdLineWidth075pt<BR>
.Co=
lor =3D wdColorAutomatic<BR>
End With<BR>
With .Borders(wdBorderHoriz=
ontal)<BR>
.Li=
neStyle =3D wdLineStyleSingle<BR>
.Li=
neWidth =3D wdLineWidth025pt<BR>
.Co=
lor =3D wdColorAutomatic<BR>
End With<BR>
With .Borders(wdBorderVerti=
cal)<BR>
.Li=
neStyle =3D wdLineStyleSingle<BR>
.Li=
neWidth =3D wdLineWidth025pt<BR>
.Co=
lor =3D wdColorAutomatic<BR>
End With<BR>
.Borders(wdBorderDiagonalDo=
wn).LineStyle =3D wdLineStyleNone<BR>
.Borders(wdBorderDiagonalUp=
).LineStyle =3D wdLineStyleNone<BR>
.Borders.Shadow =3D False<BR>
End With<BR>
With Options<BR>
.DefaultBorderLineStyle =3D
w=
dLineStyleSingle<BR>
.DefaultBorderLineWidth =3D
w=
dLineWidth025pt<BR>
.DefaultBorderColor =3D
wdCol=
orAutomatic<BR>
End With<BR>
<BR>
aTable.Rows(1).Select<BR>
With Selection<BR>
.Style =3D
ActiveDocument.Sty=
les("Table Heading")<BR>
.Rows(1).HeadingFormat =3D
Tr=
ue<BR>
With .Shading<BR>
.Te=
xture =3D wdTexture10Percent<BR>
.Fo=
regroundPatternColor =3D wdColorAutomatic<BR>
.Ba=
ckgroundPatternColor =3D wdColorAutomatic<BR>
End With<BR>
End With<BR>
<BR>
aTable.AutoFitBehavior (wdAutoFitWindow)<BR>
<BR>
End<BR>
<BR>
Error:<BR>
MsgBox "The Template has been damaged. See Tech Support.", =
vbCritical<BR>
<BR>
End Sub<BR>
<BR>
<BR>
<BR>
On 9/10/06 4:37 AM, in article 1160332667.937426.263970@xxxxxxxxxxxxxxxxxxx=
roups.com, "john@xxxxxxxxxxxxx" <john@xxxxxxxxxxxxx> wrote:<=
BR>
<BR>
<FONT COLOR=3D"#0000FF">> Hi Beth<BR>
> <BR>
> No. I wasn't seeing grey lines, but solid black ones that printe=
d.<BR>
> But I'll try AutoCorrect instead.<BR>
> <BR>
> Many thanks<BR>
> <BR>
> John<BR>
> Beth Rosengard wrote:<BR>
</FONT><FONT COLOR=3D"#008000">>> Hi John,<BR>
>> <BR>
>> I always use AutoCorrect instead of AutoText for these things (hab=
it). I<BR>
>> just tried it with a table that had no borders at all and with bol=
d in just<BR>
>> one cell. It reproduces fine.<BR>
>> <BR>
>> I don't know why AutoText isn't working for you but try AutoCorrec=
t and see<BR>
>> if it makes a difference.<BR>
>> <BR>
>> By the way, when you get rid of table borders, they turn gray; the=
y don't<BR>
>> actually disappear (except when you print). Could that be wh=
at you're<BR>
>> seeing?<BR>
>> <BR>
>> --<BR>
>> ***Please always reply to the newsgroup!***<BR>
>> <BR>
>> Beth Rosengard<BR>
>> MacOffice MVP<BR>
>> <BR>
>> Mac Word FAQ: <a
href=3D"http://word.mvps.org/Mac/WordMacHome.=
html"><http://word.mvps.org/Mac/WordMacHome.html></a><BR>
>> My Site: <a
href=3D"http://www.bethrosengard.com"><http://w=
ww.bethrosengard.com></a><BR>
>> <BR>
>> <BR>
>> <BR>
>> <BR>
>> On 10/8/06 8:18 AM, in article<BR>
>> 1160320690.065921.236980@xxxxxxxxxxxxxxxxxxxxxxxxxxx, "john@j=
ohnhands.com"<BR>
>> <john@xxxxxxxxxxxxx> wrote:<BR>
>> <BR>
</FONT><FONT COLOR=3D"#FF0000">>>> Thanks, Dailya. The reason
=
I tried a macro (which MIcrosoft Support<BR>
>>> recommended) was that I'd alrady tried Autotext. When I =
used this, it<BR>
>>> produced borders although the table I'd selected had none, and=
(if I<BR>
>>> remember correctly) it didn't have bold in one column as did t=
he<BR>
>>> selected table.<BR>
>>> <BR>
>>> John<BR>
</FONT><FONT COLOR=3D"#0000FF">> <BR>
</FONT><BR>
-- <BR>
<BR>
Please reply to the newsgroup to maintain the thread. Please do not e=
mail me unless I ask you to.<BR>
<BR>
John McGhie <john@xxxxxxxxxxx><BR>
Microsoft MVP, Word and Word for Macintosh. Business Analyst, Consult=
ant Technical Writer.<BR>
Sydney, Australia +61 (0) 4 1209 1410<BR>
</SPAN></FONT>
</BODY>
</HTML>
--B_3243265427_15662445--
--
Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.
John McGhie <john@xxxxxxxxxxx>
Microsoft MVP, Word and Word for Macintosh. Business Analyst, Consultant
Technical Writer.
Sydney, Australia +61 (0) 4 1209 1410
Attachment:
MakeTable.bas
Description: Binary data
- References:
- Macro for table problems
- From: john@xxxxxxxxxxxxx
- Re: Macro for table problems
- From: Daiya Mitchell
- Re: Macro for table problems
- From: john@xxxxxxxxxxxxx
- Re: Macro for table problems
- From: Beth Rosengard
- Re: Macro for table problems
- From: john@xxxxxxxxxxxxx
- Re: Macro for table problems
- From: john@xxxxxxxxxxxxx
- Macro for table problems
- Prev by Date: Re: Looking for update on use of XML in Word
- Next by Date: Re: Preview Icon Launch Doesn't
- Previous by thread: Re: Macro for table problems
- Next by thread: Re: Macro for table problems
- Index(es):
Relevant Pages
|