Macro: Compile Error

Y

Yannick

When I click on the button of the macro or press the
shortcut keyboard to insert a bookmark (I created that
macro in Visual Basic), I get immediately a dialog box
saying "Compile error", I press OK and appears the window
code showing hte macro. The first line "Bookmarks()" is
yellow highligted and "t =" selected in black.

Could somebody tell me what does that mean and above all
how to fix it.

This is the macro:
---------------------------------------------------
Bookmarks()
t = Selection.Text
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, Name:="b" & t
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
Selection.MoveDown Unit:=wdLine, Count:=1
End Sub
 
Y

Yannick

Hi, Jay,

Sure, you are totally right. I work on a network and
sometimes, I send the template I created to my colleagues
and onto I add sometimes some macros made by myself with
the command Tools, Macros, Run Macros.

In fact, I received that macro (Bookmarks) by mail, and
first, I copied it in a "Module 1" ... but I encountered
so many problems (I very recently sent two mails in this
NG concerning these problems) then I rewrote it in Visual
Basic on MY computer and automatically, I get the "Sub",
as you told me, that's why it works on MY computer, but
till I get your answer, I didn't know WHY it worked on
MINE and NOT on my colleagues' ones.

I will see on Monday and resend the template on the
network with the correction you gave me.

I Than you very much

Yannick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top