Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi,
I know how to pass static text to variable in Marco,
f,g : ActiveDocument.Variables("variMonth").SetContent "Jan", true
but how to pass selected field value to variable in Marco ?
thanks in advance
There are mutiple solutions. Examples (assuming the field name is "Month"):
1. Create another variable vMonth in your application and define it as
=Motnh
Your macro will be
ActiveDocument.Variables("variMonth").SetContent ActiveDocument.Variables("vMotnh").GetContent.string, true
2. Copy directly from the field
set val=ActiveDocument.Fields("Month").GetSelectedValues
ActiveDocument.Variables("variMonth").SetContent val.item(0).text, true
In any case you have to make sure that only one value is selected in th field Month, or to test this condition in your macro and to do something if the condition is false.
There are mutiple solutions. Examples (assuming the field name is "Month"):
1. Create another variable vMonth in your application and define it as
=Motnh
Your macro will be
ActiveDocument.Variables("variMonth").SetContent ActiveDocument.Variables("vMotnh").GetContent.string, true
2. Copy directly from the field
set val=ActiveDocument.Fields("Month").GetSelectedValues
ActiveDocument.Variables("variMonth").SetContent val.item(0).text, true
In any case you have to make sure that only one value is selected in th field Month, or to test this condition in your macro and to do something if the condition is false.
thanks Michael, it is working now