J
Jody L. Whitlock
I've gotten the COM Addin to work, my problem is this. I need to allow
the user to select a range of cells (All in the same column) and then
select my addin. My addin needs to pick up this range of cells and
then parse the value of each cell in this range. I have looked,
Googled, and thought I had it, but nadda.
Here's the code I have at the moment:
' *** BEGIN CUSTOM CODE. ***
Private Sub objCommandBarButton_Click(ByVal Ctrl As
CommandBarButton, _
ByRef CancelDefault As Boolean)
Dim WkBook As Excel._Workbook = applicationObject.Workbooks(1)
Dim WkSheet As Excel._Worksheet = WkBook.ActiveSheet
'Dim WkSheetNew As Excel._Worksheet =
applicationObject.Worksheets.Add(Nothing,
applicationObject.Worksheets(1))
Dim Range1 As Range = DirectCast(applicationObject.Selection,
Excel.Range)
Dim cell As Range
Dim PPS As Integer = 0
'WkSheetNew.Name = "SubTotals"
MsgBox(Range1.Address())
If Debugger.Launch() Then
For Each cell In Range1.Cells
Select Case CStr(cell.Value).Substring(0, 3)
Case Is = "PPS"
PPS += 1
End Select
Next
MsgBox("Found " & PPS & " Software Calls.")
Else
MsgBox("Couldn't Launch the Debugger")
End If
End Sub
' *** END CUSTOM CODE. ***
Thanks,
Jody W
the user to select a range of cells (All in the same column) and then
select my addin. My addin needs to pick up this range of cells and
then parse the value of each cell in this range. I have looked,
Googled, and thought I had it, but nadda.
Here's the code I have at the moment:
' *** BEGIN CUSTOM CODE. ***
Private Sub objCommandBarButton_Click(ByVal Ctrl As
CommandBarButton, _
ByRef CancelDefault As Boolean)
Dim WkBook As Excel._Workbook = applicationObject.Workbooks(1)
Dim WkSheet As Excel._Worksheet = WkBook.ActiveSheet
'Dim WkSheetNew As Excel._Worksheet =
applicationObject.Worksheets.Add(Nothing,
applicationObject.Worksheets(1))
Dim Range1 As Range = DirectCast(applicationObject.Selection,
Excel.Range)
Dim cell As Range
Dim PPS As Integer = 0
'WkSheetNew.Name = "SubTotals"
MsgBox(Range1.Address())
If Debugger.Launch() Then
For Each cell In Range1.Cells
Select Case CStr(cell.Value).Substring(0, 3)
Case Is = "PPS"
PPS += 1
End Select
Next
MsgBox("Found " & PPS & " Software Calls.")
Else
MsgBox("Couldn't Launch the Debugger")
End If
End Sub
' *** END CUSTOM CODE. ***
Thanks,
Jody W