Macro for creating bullets in word from excel

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:
Run-time error '438':
Object doesn't support this property or method.
at the line:
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.
I am using Excel 2003, the macro is in a module activated by pressing a button. Prior to the code below, I create a new word document object named "wrdApp", open up the template, and then activate "wrdApp" using "wrdApp.Activate"

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:

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,214,641
Messages
6,120,694
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top