Radical Dylan
New Member
- Joined
- Nov 21, 2011
- Messages
- 6
Hello everyone,
I wrote a macro in an excel spreadsheet that takes data from excel and then places it in a word document template that the macro loads from the C drive.
I wasn't sure how to make the bullet formatting properly, so i recorded a macro in word that essentially goes to a bookmark i previously created and then places the bullets at this bookmark (that code is located at the bottom of this post).
Once I had that done, I simply copy and pasted it over to excel and placed it where I needed it; making sure I had the bookmarks in my template word document already. However, when I ran the code I came up with an error. It doesn't even run the code, it just jumps right too the code snippet and tells me it is wrong.
The error I get is:
The references I am using are:
Any Ideas why the error is popping up? Any help would be appreciated, or even a suggestion for a better way to achieve the same result.
I wrote a macro in an excel spreadsheet that takes data from excel and then places it in a word document template that the macro loads from the C drive.
I wasn't sure how to make the bullet formatting properly, so i recorded a macro in word that essentially goes to a bookmark i previously created and then places the bullets at this bookmark (that code is located at the bottom of this post).
Once I had that done, I simply copy and pasted it over to excel and placed it where I needed it; making sure I had the bookmarks in my template word document already. However, when I ran the code I came up with an error. It doesn't even run the code, it just jumps right too the code snippet and tells me it is wrong.
The error I get is:
at the line:Run-time error '438':
Object doesn't support this property or method.
Selection.Goto What:=wdGoToBookmark, Name:="BM1"
The references I am using are:
- Visual Basic for Applications.
- Microsoft Excel 11.0 Object Library.
- OLE automation
- Microsoft Office 11.0 Object Library.
- Microsoft Visual Basic for Applications extensibility 5.3
- Microsoft Word 11.0 Object Library.
- Microsoft Shell Controls and Autoation.
Any Ideas why the error is popping up? Any help would be appreciated, or even a suggestion for a better way to achieve the same result.
Code:
Sub bulletsMacro()
Selection.GoTo What:=wdGoToBookmark, Name:="BM1"
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
With ListGalleries(wdBulletGallery).ListTemplates(1).ListLevels(1)
.NumberFormat = ChrW(61623)
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleBullet
.NumberPosition = InchesToPoints(0.25)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(0.5)
.TabPosition = InchesToPoints(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 = "Symbol"
End With
.LinkedStyle = ""
End With
ListGalleries(wdBulletGallery).ListTemplates(1).Name = ""
Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=ListGalleries( _
wdBulletGallery).ListTemplates(1), ContinuePreviousList:=False, ApplyTo:= _
wdListApplyToWholeList, DefaultListBehavior:=wdWord10ListBehavior
Selection.TypeText Text:="Hello"
Selection.TypeParagraph
Selection.TypeText Text:="At"
Selection.TypeParagraph
Selection.TypeText Text:="<<1>>"
End Sub
Last edited: