J
Jon Reynolds
I need to do a printscreen in Access 97. I have a button
invoking a macro calling the following VB function.
Whenever it is run, I get a type mismatch error. I'm no
expert in VB and hope someone can spot the error in the
code.
The Macro RunCode is:
PrintScreenBW (screen.activeform, True)
The VB script is:
Function PrintScreenBW(F As Form, Mode As Integer)
Dim I As Integer, NumberControls As Integer
Dim c As Control
' On Error Resume Next
NumberControls = F.Count
If Mode Then
For I = 0 To NumberControls - 1
Set c = F(I)
If TypeOf c Is LABEL Then
c.Tag = c.ForeColor
c.ForeColor = QBColor(0)
ElseIf TypeOf c Is TextBox Then
c.Tag = c.ForeColor
c.ForeColor = QBColor(0)
ElseIf TypeOf c Is Rectangle Then
c.Tag = c.BorderColor
c.BorderColor = QBColor(0)
ElseIf TypeOf c Is Line Then
c.Tag = c.BorderColor
c.BorderColor = QBColor(0)
ElseIf TypeOf c Is optiongroup Then
c.Tag = c.BorderColor
c.BorderColor = QBColor(0)
ElseIf TypeOf c Is SubForm Then
A = PrintScreenBW(c.Form, Mode)
End If
Next I
Else
For I = 0 To NumberControls - 1
Set c = F(I)
If TypeOf c Is LABEL Then
c.ForeColor = c.Tag
ElseIf TypeOf c Is TextBox Then
c.ForeColor = c.Tag
ElseIf TypeOf c Is Rectangle Then
c.BorderColor = c.Tag
ElseIf TypeOf c Is Line Then
c.BorderColor = c.Tag
ElseIf TypeOf c Is optiongroup Then
c.BorderColor = c.Tag
ElseIf TypeOf c Is SubForm Then
A = PrintScreenBW(c.Form, Mode)
End If
Next I
End If
End Function
invoking a macro calling the following VB function.
Whenever it is run, I get a type mismatch error. I'm no
expert in VB and hope someone can spot the error in the
code.
The Macro RunCode is:
PrintScreenBW (screen.activeform, True)
The VB script is:
Function PrintScreenBW(F As Form, Mode As Integer)
Dim I As Integer, NumberControls As Integer
Dim c As Control
' On Error Resume Next
NumberControls = F.Count
If Mode Then
For I = 0 To NumberControls - 1
Set c = F(I)
If TypeOf c Is LABEL Then
c.Tag = c.ForeColor
c.ForeColor = QBColor(0)
ElseIf TypeOf c Is TextBox Then
c.Tag = c.ForeColor
c.ForeColor = QBColor(0)
ElseIf TypeOf c Is Rectangle Then
c.Tag = c.BorderColor
c.BorderColor = QBColor(0)
ElseIf TypeOf c Is Line Then
c.Tag = c.BorderColor
c.BorderColor = QBColor(0)
ElseIf TypeOf c Is optiongroup Then
c.Tag = c.BorderColor
c.BorderColor = QBColor(0)
ElseIf TypeOf c Is SubForm Then
A = PrintScreenBW(c.Form, Mode)
End If
Next I
Else
For I = 0 To NumberControls - 1
Set c = F(I)
If TypeOf c Is LABEL Then
c.ForeColor = c.Tag
ElseIf TypeOf c Is TextBox Then
c.ForeColor = c.Tag
ElseIf TypeOf c Is Rectangle Then
c.BorderColor = c.Tag
ElseIf TypeOf c Is Line Then
c.BorderColor = c.Tag
ElseIf TypeOf c Is optiongroup Then
c.BorderColor = c.Tag
ElseIf TypeOf c Is SubForm Then
A = PrintScreenBW(c.Form, Mode)
End If
Next I
End If
End Function