Macro: Remove Spacing Between Table Cells

I received a document that had hundreds of tables, all with a nice 3D border. Then somebody said that the border looked ugly so I started writing a macro to change all the borders to something more plain. Changing the borders was simple, but the cells had space between them which resulted in a double border. Getting rid of this space was not so simple.
Finally, I found this little macro at the Egghead Cafe:
With Dialogs(wdDialogTableTableOptions)
.AllowSpacing = 0
.Execute
End With
 
A second method (that I did not try) is to use this:

Selection.Tables(1).Spacing = -1
 
The full macro follows:
Sub remove3dBorder()
'
' remove3dBorder Macro
'
'
Dim myT As Table

For Each myT In ActiveDocument.Tables

myT.Select

'Selection.Rows.HeadingFormat = True
With Selection.Tables(1)
With .Borders(wdBorderLeft)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderRight)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
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
.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
.Borders.Shadow = False

.TopPadding = CentimetersToPoints(0)
.BottomPadding = CentimetersToPoints(0)
.LeftPadding = CentimetersToPoints(0)
.RightPadding = CentimetersToPoints(0)
With Dialogs(wdDialogTableTableOptions)
.AllowSpacing = 0
.Execute
End With

.AllowPageBreaks = True
.AllowAutoFit = True
End With

' turn on header row
myT.Cell(1, 1).Select
Selection.Rows.HeadingFormat = True

Next myT
End Sub

[Source Egghead Cafe and Google Answers] 

Macro: Repetitive Replacing of Table Cells

Here is today’s time saver:
I had some tables (actually 1000 pages of tables!) where I needed to replace cells containing various text (denoted by comments from the SME) with a standard word (which was Reserved in this case). Normally, I would triple-click in the cell and then control-v to paste in the text (5 clicks/keys), but there were too many places that I needed to make this change.
Using the following macro this task was reduced to two clicks, once in the cell and then once on the button for the macro. There was one other requirement for this macro, which was that if the cell was in bold, it received slightly different text.

Sub makeCellReserved()
   Selection.SelectCell

   If Selection.Range.Bold = True Then
       Selection.Text = “RESERVED”
   Else
       Selection.Text = “Reserved”
   End If
End Sub

AIT: Highlighting Variants

This post describes how I use highlighting and release states in Author-It to make reviewing documents easier. This procedure assumes that you have a main book along with another book that uses variants of the objects in the main book. The variants are either variant topics or embedded variant topics. 
By using this procedure, the reviewer can review one complete document, and then just review the highlighted sections in the second document.
Setup

1. Open AIT Administrator
2. Select Security -> Release States
3. Add a new state:

a. Right click -> Add State
b. State name: HighlightVar
c. Right click over the new state, select Check Row
d. Click the box near the end of the row for HighlightVar / Review Color
e. Select yellow
f. Check that the boxes are checked for all relevant users

4. Do step 3 again to add the state DoNotHighlightVar, but skip steps d and e.

5. Close AIT Administrator
6. Open AIT
7. In your library, sort the objects by variant
8. Select (using Ctrl+click) all variants of the default object
9. Right mouse click, then select Change Release State -> HighlightVar

The variant of the main document can now be published with highlighted sections.

Print Without Highlighting

1. Go to the search tab
2. Select HighlightVar from In State
3. Click on Find Now
4. The search result shows all of the objects with highlighting
5. Select all of the objects
6. Right click -> Change Release State -> DoNoHighlightVar
7. Publish

Print with Highlighting
1. Go to the search tab
2. Select DoNoHighlightVar from In State
3. Click on Find Now
4. The search result shows all of the objects with highlighting
5. Select all of the objects
6. Right click -> Change Release State -> HighlightVar
7. Publish

Thanks to Miriam Lottner at Tech-Tav for pointing me in the right direction.

Split Excel Columns into Multiple Rows

I am always forgetting how to do this, so today I am writing it down. When you have one long column of data in Excel and you want to split it into multiple rows of data (such as rows with 5 columns), how do you do it?
Assuming the data is in column A, then put into B1:

=Indirect(Address((Row(A1)-1)*5+Column(A1),1))

Copy to the right four times and then down as far as you need to. If you want to change the number of columns in the result, then change the ‘5’ to the # of columns.

[Source OzGrid]

Author-It: Pasting Text with Formatting

For those of you using Author-It, there is an unfortunate feature that text that is pasted into a topic (from a Word doc), gets a “No Paragraph Style”. You then have to select the text and apply an AIT style. At the latest Author-It User Group meeting, the way to get around this was revealed.
Follow these steps:
  1. From the main window select: Import -> (Transformation) Profiles
  2. Select Word Documents
  3. Click Properties
  4. Check the box next to Use for Paste
Now, when you want to paste text into AIT, click:
Paste -> Paste Using Import Profile -> Word Documents

That’s it. Happy pasting.

Filename Field Code in Word

Many times I’ll use a field code to insert the filename into the footer of a document. The field code looks like this:

{ FILENAME \*MERGEFORMAT}
The result of the field code looks like this: foobar.doc

The filename has a “.doc” suffix. When I create the PDF, the filename in the footer still has the “.doc” suffix, and not “.pdf”.

What I found is that the field code uses the filename exactly as it appears in the Windows Explorer window. This may sound trivial, but to solve the problem we just need to hide the extension in Windows Explorer.
To change the setting follow these steps:
  1. Open Windows Explorer
  2. Click Tools -> Folder Options
  3. Click on the View tab
  4. Check Hide extensions for known file types
Now, after updating the field code, we get foobar instead of foobar.doc.

[Source Wordribbon.Tips.net]

Painting in Irfanview

You learn something everyday. A co-worker asked me if I knew of a program to add circles and arrows to an image. Immediately, I thought “Irfanview must be able to do that“. 
Quickly, I opened an image in Irfanview and searched the menus for “Add circle” or “Add arrow” or something like that. Instead I found the menu for “Show Paint Dialog”. Bingo.
Click “Edit -> Show Paint Dialog”, or type F12 and the MS Paint dialog opens. Now you have the capability of MS Paint from within Irfanview. Add a circle, add an arrow, or whatever you like 🙂