Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Can anyone please help on the below function, I am trying to select the value U and V on the sheet activation but it's not working with the below code... [:s]
sub MakeSelection()
ActiveDocument.Fields("BLOCKCODE1").Select 'U','V'
ActiveDocument.Fields("BLOCKCODE2").Select 'U','V'
ActiveDocument.Fields("BLOCKCODE3").Select 'U','V'
end sub
Regards,
Shumail Hussain
Hi,
try that example:
sub MakeSelection()
set curentField = ActiveDocument.Fields("BLOCKCODE1")
'Initialize array of values for selection
set arrayOfValues = curentField.GetNoValues
'Add New Element in array
arrayOfValues.add
'Fill this element
arrayOfValues(0).Text = "U"
arrayOfValues(0).IsNumeric = false
'Add New Element in array
arrayOfValues.add
'Fill this element
arrayOfValues(1).Text = "V"
arrayOfValues(1).IsNumeric = false
curentField.SelectValues arrayOfValues
end sub
for more details see in attachment and APIguide.qvw.
best regards, Anatoly.
Hi,
try that example:
sub MakeSelection()
set curentField = ActiveDocument.Fields("BLOCKCODE1")
'Initialize array of values for selection
set arrayOfValues = curentField.GetNoValues
'Add New Element in array
arrayOfValues.add
'Fill this element
arrayOfValues(0).Text = "U"
arrayOfValues(0).IsNumeric = false
'Add New Element in array
arrayOfValues.add
'Fill this element
arrayOfValues(1).Text = "V"
arrayOfValues(1).IsNumeric = false
curentField.SelectValues arrayOfValues
end sub
for more details see in attachment and APIguide.qvw.
best regards, Anatoly.
Hi Shumail,
Here's an example for selecting U and V in a field called F1:
sub Sel()
ActiveDocument.Fields("F1").Select "U"
ActiveDocument.Fields("F1").ToggleSelect "V"
end sub
This can be created using actions instead of running it as a macro although it shouldn't really make any difference.
your code is working perfectly... ![]()
Thanks Johannes!
Regards,
Shumail Hussain
Thanks Anatoly, your code is also working.
Regards,
Shumail Hussain
Thanks for sharing .. worked wonders