I asked this question a week or sso ago but did not make it clear exacctly
what I needed to do. Someone called Doug offered some suggestions but I
cannot find the original post - so here is my question:
I want to automate a repetitive sequence by creating a macro to run the
following actions, (once Record New Macro has been started):
Click on Insert
Click on Field
In Categories, click on Mailmerge
In Fieldnames, click on MergeField
Place the cursor into the field where you can type in the name or
description of the mailmerge field.
Now, STOP recording. (Because the details of the mergefield will be
different every time that this is used, on the many hundreeds of mergefields
that we need to create)
Trouble is, with this dialogue box open, you cannot click on the macro
toolbar to stop the recording. Is there a keystroke/combination that does
this? Or any tother solution?
Doug xxxx did try to help me before but I didn't describe the requirement
quite correctly and also I cannot find that previous post...
Many thanks
CW

Re: Stop recording macro while dialogue box is open by Greg

Greg
Sun Oct 23 08:48:15 CDT 2005

CW,

Probably Doug Robbins and he may be along shortly to show us both a better
way. For now, you can try:

Sub Test()
Dim i As Long
For i = 1 To 37 'the 37th field in the list
SendKeys "{Down}"
Next
SendKeys "{Tab}"
With Application.Dialogs(wdDialogInsertField)
.Show
End With
End Sub

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

CW wrote:
> I asked this question a week or sso ago but did not make it clear
> exacctly what I needed to do. Someone called Doug offered some
> suggestions but I cannot find the original post - so here is my
> question:
> I want to automate a repetitive sequence by creating a macro to run
> the following actions, (once Record New Macro has been started):
> Click on Insert
> Click on Field
> In Categories, click on Mailmerge
> In Fieldnames, click on MergeField
> Place the cursor into the field where you can type in the name or
> description of the mailmerge field.
> Now, STOP recording. (Because the details of the mergefield will be
> different every time that this is used, on the many hundreeds of
> mergefields that we need to create)
> Trouble is, with this dialogue box open, you cannot click on the macro
> toolbar to stop the recording. Is there a keystroke/combination that
> does this? Or any tother solution?
> Doug xxxx did try to help me before but I didn't describe the
> requirement quite correctly and also I cannot find that previous
> post...
> Many thanks
> CW



Re: Stop recording macro while dialogue box is open by Greg

Greg
Sun Oct 23 09:00:09 CDT 2005

CW,

Why use the dialog at all? Consider:

Sub InsertMergeField()
Dim oRng As Range
Set oRng = Selection.Range
Dim oName As String
oName = InputBox("Enter the mergefield name: ", "Field Name")
ActiveDocument.Fields.Add oRng, wdFieldMergeField, oName
End Sub

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

CW wrote:
> I asked this question a week or sso ago but did not make it clear
> exacctly what I needed to do. Someone called Doug offered some
> suggestions but I cannot find the original post - so here is my
> question:
> I want to automate a repetitive sequence by creating a macro to run
> the following actions, (once Record New Macro has been started):
> Click on Insert
> Click on Field
> In Categories, click on Mailmerge
> In Fieldnames, click on MergeField
> Place the cursor into the field where you can type in the name or
> description of the mailmerge field.
> Now, STOP recording. (Because the details of the mergefield will be
> different every time that this is used, on the many hundreeds of
> mergefields that we need to create)
> Trouble is, with this dialogue box open, you cannot click on the macro
> toolbar to stop the recording. Is there a keystroke/combination that
> does this? Or any tother solution?
> Doug xxxx did try to help me before but I didn't describe the
> requirement quite correctly and also I cannot find that previous
> post...
> Many thanks
> CW



Re: Stop recording macro while dialogue box is open by Doug

Doug
Sun Oct 23 12:08:39 CDT 2005

The only thing that I would add to Greg's second post is a caution that
there is a real chance that if mergefields are created into this way, they
may not match exactly the fields in the datasource.

If the normal procedure of creating a mailmerge main document is followed,
when the datasource is attached to the main document, the insert mergefield
button presents a list of the available mergefields, so there is no need to
re-type the names.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"CW" <CW@discussions.microsoft.com> wrote in message
news:70AF22C5-3CF7-406E-821C-524640B30501@microsoft.com...
>I asked this question a week or sso ago but did not make it clear exacctly
> what I needed to do. Someone called Doug offered some suggestions but I
> cannot find the original post - so here is my question:
> I want to automate a repetitive sequence by creating a macro to run the
> following actions, (once Record New Macro has been started):
> Click on Insert
> Click on Field
> In Categories, click on Mailmerge
> In Fieldnames, click on MergeField
> Place the cursor into the field where you can type in the name or
> description of the mailmerge field.
> Now, STOP recording. (Because the details of the mergefield will be
> different every time that this is used, on the many hundreeds of
> mergefields
> that we need to create)
> Trouble is, with this dialogue box open, you cannot click on the macro
> toolbar to stop the recording. Is there a keystroke/combination that does
> this? Or any tother solution?
> Doug xxxx did try to help me before but I didn't describe the requirement
> quite correctly and also I cannot find that previous post...
> Many thanks
> CW
>
>