Does anyone have URLs to resources for referencing MS Office object properties? For example if I want to format a MS Word document, I would use code like:
Public Sub openword1()
Dim wordapp As New Word.Application
Dim d As Word.Document
Set d = wordapp.Documents.Add
wordapp.Visible = True
d.Activate
With wordapp
.Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
.Selection.Font.Bold = wdToggle
.Selection.Font.Size = 14
.Selection.TypeText Text:="this is a test for openword1"
.Selection.TypeParagraph
.Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
.Selection.Font.Bold = wdToggle
.Selection.Font.Size = 12
.Selection.TypeParagraph
.Selection.TypeParagraph
With ListGalleries(wdNumberGallery).ListTemplates(1).ListLevels(1)
.NumberFormat = "%1."
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = "0.25"
.Alignment = wdListLevelAlignLeft
.TextPosition = "0.5"
.TabPosition = "0.5"
.ResetOnHigher = 0
.StartAt = 1
With .Font
.Bold = wdUndefined
.Italic = wdUndefined
.Strikethrough = wdUndefined
.Subscript = wdUndefined
.Superscript = wdUndefined
.Shadow = wdUndefined
.Outline = wdUndefined
.Emboss = wdUndefined
.Engrave = wdUndefined
.AllCaps = wdUndefined
.Hidden = wdUndefined
.Underline = wdUndefined
.Color = wdUndefined
.Size = wdUndefined
.Animation = wdUndefined
.DoubleStrikeThrough = wdUndefined
.Name = ""
.Position = "0" 'this is not a measurable option, but has options 0, 1, and 2.
End With
.LinkedStyle = ""
End With
With ListGalleries(wdNumberGallery)
.Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=wordapp.ListGalleries(wdNumberGallery).ListTemplates(1), _
ContinuePreviousList:=False, _
ApplyTo:=wdListApplyToWholeList, _
DefaultListBehavior:=wdWord9ListBehavior
.Selection.TypeText Text:="I changed alignment to center, toggled bold on, changed font size to 14, and typed in title."
.Selection.TypeParagraph
.Selection.TypeText Text:="Then I hit enter once, changed alignment to left, toggled bold off, changed font size to 12, and hit enter twice."
.Selection.TypeParagraph
.Selection.TypeText Text:="Then I turned numbered bullets on, and typed in bullets 1, 2, and 3, then stopped recording."
End With
End With
Set wordapp = Nothing
'wordapp.Quit
'd.Close
End Sub
However some properties are difficult to understand, and to find, and to know where to place properly. In the above code, when I enter text with my numbered bullet points, the font that goes to a new line does not line up with the line above it ( this would be the .textposition = "0.5", but as soon as I get out of the With .ListGalleries...that property becomes undefined.
I AM NOT looking for an answer to the above code. It runs well enough, and I can figure it out on my own. I NEED a handy resource that lists all properties for objects, and hopefully with parent/child trees. Using the Help or Object Browser from the coding windows really don't explain well enough.
Did you hear about the programmer who almost drowned in the shower? He was in the shower for days following the directions on the back of his shampoo bottle...lather, rinse, repeat...