O
Owen
I am using an activex control (combobox) in a macro that exists within my
word document. I have attached my code below.
The problem is that even when the combobox selection is NOT equal to CLAY,
the macro still executes the code as if the combobox selection was CLAY.
Prehaps the "if result =" method is not valid here?
Appreciate any help you can offer.
Sub test()
Dim CB26 As Object
Set CB26 = ActiveDocument.ComboBox26
With CB26
If Result = CLAY Then
Selection.GoTo What:=wdGoToBookmark, Name:="Sample1"
Selection.MoveRight unit:=wdCharacter, Count:=1,
Extend:=wdExtend
Selection.Copy
Selection.GoTo What:=wdGoToBookmark, Name:="Result1"
Selection.Paste
Else
Selection.GoTo What:=wdGoToBookmark, Name:="Sample11"
Selection.MoveRight unit:=wdCharacter, Count:=1,
Extend:=wdExtend
Selection.Copy
Selection.GoTo What:=wdGoToBookmark, Name:="Result1"
Selection.Paste
End If
End With
End Sub
word document. I have attached my code below.
The problem is that even when the combobox selection is NOT equal to CLAY,
the macro still executes the code as if the combobox selection was CLAY.
Prehaps the "if result =" method is not valid here?
Appreciate any help you can offer.
Sub test()
Dim CB26 As Object
Set CB26 = ActiveDocument.ComboBox26
With CB26
If Result = CLAY Then
Selection.GoTo What:=wdGoToBookmark, Name:="Sample1"
Selection.MoveRight unit:=wdCharacter, Count:=1,
Extend:=wdExtend
Selection.Copy
Selection.GoTo What:=wdGoToBookmark, Name:="Result1"
Selection.Paste
Else
Selection.GoTo What:=wdGoToBookmark, Name:="Sample11"
Selection.MoveRight unit:=wdCharacter, Count:=1,
Extend:=wdExtend
Selection.Copy
Selection.GoTo What:=wdGoToBookmark, Name:="Result1"
Selection.Paste
End If
End With
End Sub