I have the following code to loop through a series of activex checkboxes in a frame. I then want to pass the strReportName variable into other subs and functions. When I hover over strReportName in the code, it is listing the correct string, but when I set a watch for this variable, the value is "expression not defined in context<expression not="" defined="" in="" context="">".
Does anyone know what I am doing wrong? Thanks in advance!
<code>Sub RunScenarios()
Dim chk As Control
Dim strReportName As String
For Each chk In wsForm.frameReports.Controls
If TypeName(chk) = "CheckBox" Then
If chk.Value = True Then
strReportName = chk.Caption
Call CreateEmail(strReportName)
End If
End If
Next
End Sub</code></expression>
Does anyone know what I am doing wrong? Thanks in advance!
<code>Sub RunScenarios()
Dim chk As Control
Dim strReportName As String
For Each chk In wsForm.frameReports.Controls
If TypeName(chk) = "CheckBox" Then
If chk.Value = True Then
strReportName = chk.Caption
Call CreateEmail(strReportName)
End If
End If
Next
End Sub</code></expression>
Last edited: