use a function

A

Andrew

Hi,

How can I use a function created in Macros on a Word document? for example:
I insert a mail merge field, which is a number, and this field will be an
input argument of the function:
1234 will input to the function
function changeItToMyNeed(insertfield)
'...my code here
End function

Thanks for any help.

Andrew
 
A

Andrew

Hi Andrew,

Your syntax for calling the function looks good. Do you want to know how to
assign 1234 to a variable so that you can call your function? Try selecting
the value and using the following code

Sub CallFunction()

Dim FieldValue As Integer

FieldValue = Selection
MsgBox (changeItToMyNeed(FieldValue))
End Sub
 

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