Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel losing Macros
Message
From
09/10/2001 14:59:52
 
 
To
All
General information
Forum:
Microsoft Office
Category:
Excel
Title:
Excel losing Macros
Miscellaneous
Thread ID:
00566128
Message ID:
00566128
Views:
50
Hello everyone, I have a project with two macros and I create a right click menu based on col. The problem is that the following code worked and now it has stopped. This code is exactly like the example in help. The Region is chosen from the first col and the PW is created assigned to the 10th col. This was working beautifuly. Then I added another macro and it modified this code very little save it passed the actual string value and I was never able to get tat to work. Then after a save and reopen makePW cant be found. I have made it public, I've used the tools/macro dialog to add the macro and it refuses to function.

'code from the sheet
Public JHPW As Object 'JH_RDTools.JHPassword

Private Sub Worksheet_Activate()
Set JHPW = CreateObject("JH_RDTools.JHPassword")
End Sub

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, _
Cancel As Boolean)
For Each icbc In Application.CommandBars("cell").Controls
If icbc.Tag = "oCreate" Or icbc.Tag = "oVal" Then icbc.Delete
Next icbc

If Not Application.Intersect(Target, Range("A2:A10000")) _
Is Nothing Then
With Application.CommandBars("cell").Controls _
.Add(Type:=msoControlButton, Before:=1, _
temporary:=True)
.Caption = "Create new Password for " & Cells(Target.Cells.Row, 4)
iRegionNum = Cells(Target.Cells.Row, 1)
iRow = Target.Cells.Row
'Debug.Print "makepw(" & iRegionNum & "," & iRow & ")"
strOnAction = "makepw(" & iRegionNum & "," & iRow & ")"
.OnAction = strOnAction
.Tag = "oCreate"
End With
End If
End Sub

' Code from the module
Public Function MakePW(Region, iRow)
NewPass = JHPW.Create(Trim(Val(Region)))
Cells(iRow, 10) = NewPass
End Function
~Joe Johnston USA

"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams

Reply
Map
View

Click here to load this message in the networking platform