Dim objBookmark As Bookmark
For Each objBookmark In ActiveDocument.Bookmarks
objBookmark.Delete
Next
End Sub
For Each objBookmark In ActiveDocument.Bookmarks
objBookmark.Delete
Next
End Sub
Use the Word macro code below to set every column in every table to the width of the corresponding column in the reference table.
Continue reading “Word Macro: Set all Columns to the Same Width in Every Table”
Sub PasteSpecialAsText()
Selection.PasteSpecial DataType:=wdPasteText
End Sub
[Source LifeHacker]
There is probably a smarter way to select the maximum number of rows, but for my data it was fixed.
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]
If Selection.Range.Bold = True Then
Selection.Text = “RESERVED”
Else
Selection.Text = “Reserved”
End If
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
| [Color 0] | [Color 0] | [Color 15] | [Color 15] | [Color 30] | [Color 30] | [Color 45] | [Color 45] | |||
| [Color 1] | [Color 1] | [Color 16] | [Color 16] | [Color 31] | [Color 31] | [Color 46] | [Color 46] | |||
| [Color 2] | [Color 2] | [Color 17] | [Color 17] | [Color 32] | [Color 32] | [Color 47] | [Color 47] | |||
| [Color 3] | [Color 3] | [Color 18] | [Color 18] | [Color 33] | [Color 33] | [Color 48] | [Color 48] | |||
| [Color 4] | [Color 4] | [Color 19] | [Color 19] | [Color 34] | [Color 34] | [Color 49] | [Color 49] | |||
| [Color 5] | [Color 5] | [Color 20] | [Color 20] | [Color 35] | [Color 35] | [Color 50] | [Color 50] | |||
| [Color 6] | [Color 6] | [Color 21] | [Color 21] | [Color 36] | [Color 36] | [Color 51] | [Color 51] | |||
| [Color 7] | [Color 7] | [Color 22] | [Color 22] | [Color 37] | [Color 37] | [Color 52] | [Color 52] | |||
| [Color 8] | [Color 8] | [Color 23] | [Color 23] | [Color 38] | [Color 38] | [Color 53] | [Color 53] | |||
| [Color 9] | [Color 9] | [Color 24] | [Color 24] | [Color 39] | [Color 39] | [Color 54] | [Color 54] | |||
| [Color 10] | [Color 10] | [Color 25] | [Color 25] | [Color 40] | [Color 40] | [Color 55] | [Color 55] | |||
| [Color 11] | [Color 11] | [Color 26] | [Color 26] | [Color 41] | [Color 41] | [Color 56] | [Color 56] | |||
| [Color 12] | [Color 12] | [Color 27] | [Color 27] | [Color 42] | [Color 42] | |||||
| [Color 13] | [Color 13] | [Color 28] | [Color 28] | [Color 43] | [Color 43] | |||||
| [Color 14] | [Color 14] | [Color 29] | [Color 29] | [Color 44] | [Color 44] |
[Source MVPS site]
Set rngDoc = ActiveDocument.Content
rngDoc.Collapse Direction:=wdCollapseEnd
For Each proDoc In ActiveDocument.BuiltInDocumentProperties
With rngDoc
.InsertParagraphAfter
.InsertAfter proDoc.Name & “= “
On Error Resume Next
.InsertAfter proDoc.Value
End With
Next
End Sub
Save the project (‘File’ -> ‘Save’) and return to Outlook. From now on, the code will be called every time you press the send-button after you composed an email. Outlook will pop up a warning when you try sending an email with an empty subject line.