One macro calling up another macro

R

Rosemary

Hi,

I have created a letterhead template that, when opened,
first gives the user an opportunity to select a name for
whom the letterhead is being created. The macro then
plops the name of the selected individual into the
letterhead.

The secretaries would like a button on their toolbar that
automatically gives them the name of their boss without
their having to select it. My idea is to create a macro
that opens the template, goes ahead and selects the chosen
name, and finishes creating the letterhead with the chosen
name in it.

I went through the steps and recorded a macro. However,
the macro that gets recorded stops at the point where the
user interface appears and allows the user to select a
name. It does not record the name that is selected. Do I
need to write this code since it is not picking it up in
the recording process?

Thanks,
 
D

Doug Robbins - Word MVP

Insert a userform into your template and have a combobox on the userform
that contains the names of the individuals.

See the article "How to create a Userform" at:

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm


--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
C

Charles Kenyon

Instead, how about configuring the letterhead with an AutoText field that
has the boss's name as an AutoText entry. Create a separate template for
each secretary that holds the AutoText entry. Save that template in the Word
startup folder for that secretary. This way, the same template will display
different boss names depending on which secretary is the computer user.
--

Charles Kenyon

Word New User FAQ & Web Directory:
<URL: http://addbalance.com/word/index.htm>

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide)
<URL: http://addbalance.com/usersguide/index.htm>

See also the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
G

Guest

One thing I forgot to mention - our letterhead changes 3-4
times a year. Names change. So I am trying to avoid
using AutoText, since that means that 40 people will have
to update their individual AutoText entries each time the
letterhead changes. That's why I was thinking of creating
a macro to call up the template macro and fill it in.
 
C

Charles Kenyon

No, it doesn't mean that. It means that the AutoText is in a central
repository - a global template. They could also have an individual global
template that simply had the boss's name. That way they don't have to type
it in or choose it every time. When they change bosses, they change their
AutoText entry in their global.
--

Charles Kenyon

Word New User FAQ & Web Directory:
<URL: http://addbalance.com/word/index.htm>

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide)
<URL: http://addbalance.com/usersguide/index.htm>

See also the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
G

Guest

I see! Thank you, Charles.

-----Original Message-----
No, it doesn't mean that. It means that the AutoText is in a central
repository - a global template. They could also have an individual global
template that simply had the boss's name. That way they don't have to type
it in or choose it every time. When they change bosses, they change their
AutoText entry in their global.
--

Charles Kenyon

Word New User FAQ & Web Directory:
<URL: http://addbalance.com/word/index.htm>

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide)
<URL: http://addbalance.com/usersguide/index.htm>

See also the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ------- --
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.




.
 
D

Doug Robbins - Word MVP

I would still recommend the use of an userform with a combobox that is
populated with data (the names) contained in a table in a separate document
where it is easy to maintain.

Here's some code that would load a combobox with the name of cmbNames in the
userform with the names that are entered into a table in the document
defined as the sourcedoc document:

Dim sourcedoc As Document, i As Long, myitem As Range
' Modify the path in the following line so that it matches where you saved
the data document
Set sourcedoc = Documents.Open(FileName:="j:\drive D40\Documents\data.doc")
For i = 2 To sourcedoc.Tables(1).rows.Count
Set myitem = sourcedoc.Tables(1).Cell(i, 1).Range
myitem.End = myitem.End - 1
cmbNames.AddItem myitem.Text
Next i
sourcedoc.Close SaveChanges:=wdDoNotSaveChanges


--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 

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