Reham you asked me the following:

> Thanks for your help....I tried your code and it works fine
>
> but I need to ask you ....If I made macros in the VBA
> and I would like to assign it to a menu in word automatically and make
> the
> process of setup to be run automatically instead of importng it
> from(file....import macro)..so all the macro will be in the default
> normal
> template automatically
> Is it possible to do it?
>
> Thank you once again
>
> Reham elgammal
>
> Testing department


My solution:

For installing you could either use the autorun commands but you can also
create a new normal template which also contains the toolbar and the macro
code.

For Excel there are a few autorun events, for word I don't know which are
available but they could be the same also.

Auto_Open
User opens the workbook containing the procedure

Auto_Close
User closes the workbook containing the procedure

Auto_Add
User installs the add-in that contains the procedure, or the Installed property
of the add-in is set to True.

Auto_Remove
User removes the add-in that contains the procedure or the Installed property
of the add-in is set to False.

You could use the AutoOpen like this for instance:

Sub Auto_Open()
cmdbarName = "Enter the commandbar name here..."
' The next line s check if the commandbar already exists else it is created
For i = 1 To CommandBar.Count
If CommandBar.Name = cmdbarName Then
Exit For
Else
CommandBar.Add (cmdbarName)
Next i
End Sub

Good luck!

Jonathan

Though I welcome e-mail, please post messages in this tread so everybody
can read them and comment on them.