MeStillLearning
New Member
- Joined
- Feb 1, 2018
- Messages
- 3
Hi Folks,
Hope you can help.
I have a userform that uses an inkpicture object named "Signature_Pad" to obtain the users signature and place it on an excel sheet. The userform opens when a user selects one of the Named Ranges I have created (4 in total), using Worksheet_SelectionChange.
I have 2 named ranges on one sheet named "Handicap" and 2 named ranges on another sheet named "MatchSheet".
To determine which named range is currently selected, (so I may adjust the newInk), I use the Function InRange (seen Below) in code.
Now this works perfectly when either named range on the sheet named "Handicap" is selected but on the sheet "MatchSheet", it returns the error -:
Runtime error '1004'
method 'Intersect' of object '_Application' failed
Error triggers on
I just can't seem to figure out what I'm doing wrong. All my searches for this error only seem to come back with Global failed not application failed and don't give me the answer I'm searching for.
any help would be much appreciated.
cheers.
the code below is in my userform code.
Hope you can help.
I have a userform that uses an inkpicture object named "Signature_Pad" to obtain the users signature and place it on an excel sheet. The userform opens when a user selects one of the Named Ranges I have created (4 in total), using Worksheet_SelectionChange.
I have 2 named ranges on one sheet named "Handicap" and 2 named ranges on another sheet named "MatchSheet".
To determine which named range is currently selected, (so I may adjust the newInk), I use the Function InRange (seen Below) in code.
Now this works perfectly when either named range on the sheet named "Handicap" is selected but on the sheet "MatchSheet", it returns the error -:
Runtime error '1004'
method 'Intersect' of object '_Application' failed
Error triggers on
Code:
[COLOR=#222222][FONT=Verdana]InRange = Not (Application.Intersect(Range1, Range2) Is Nothing)[/FONT][/COLOR]
any help would be much appreciated.
cheers.
the code below is in my userform code.
Code:
Function InRange(Range1 As Range, Range2 As Range) As Boolean
' returns True if Range1 is within Range2
InRange = Not (Application.Intersect(Range1, Range2) Is Nothing)
End Function
Private Sub cmdbtnUse_Click()
Signature_Area.Ink.ClipboardCopy
On Error Resume Next
Application.EnableEvents = False
ActiveSheet.Paste
Application.EnableEvents = True
If Err Then Exit Sub
On Error GoTo 0
OpenClipboard (0&)
EmptyClipboard
CloseClipboard
Set newInk = Selection
With newInk
If InRange(ActiveCell, Range("hanWinCapSign")) Then
.Name = "WinnerSign"
.Top = Range("hanWinCapSign").Top
.Left = Range("hanWinCapSign").Left
ElseIf InRange(ActiveCell, Range("hanLosCapSign")) Then
.Name = "LoserSign"
.Top = Range("hanLosCapSign").Top
.Left = Range("hanLosCapSign").Left
ElseIf InRange(ActiveCell, Range("matWinCapSign")) Then
.Name = "WinnerSign"
.Top = Range("matWinCapSign").Top
.Left = Range("matWinCapSign").Left
ElseIf InRange(ActiveCell, Range("matLosCapSign")) Then
.Name = "LoserSign"
.Top = Range("matLosCapSign").Top
.Left = Range("matLosCapSign").Left
End If
End With
Unload Me
End Sub