Thread
:
How do I insert/update VBA code into a sheet? (using a CLS file?)
View Single Post
#
1
Posted to microsoft.public.excel.programming
Chip Pearson
external usenet poster
Posts: 7,247
How do I insert/update VBA code into a sheet? (using a CLS file?)
Peter,
See
www.cpearson.com/excel/vbe.htm
for examples.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
"Peter McNaughton" wrote in message
om...
Hi,
I have a file WORKBOOK.xls with a a number of sheets, one of which is
WORKINGS.
I wish to change the existing code which consisted only of
Worksheet_BeforeRightClick(...) and Worksheet_BeforeDoubleClick(...)
with 2 new procedures Worksheet_Actvate(...) and
Worksheet_Deactivate(...).
I have created a CLS file but don't know how to replace the existing
code with the contents of Workings.cls.
I also wish to add similar code into another sheet which doesn't have
any code.
Would appreciate some guideance
Peter
Workings.Cls follows:
Attribute VB_Name = "Workings"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Private Sub Worksheet_Activate()
Me.Protect userinterfaceonly:=True
If Application.StatusBar = "Preview Materials By Category..." Then
Else
If hasPreconstructionRights Or hasContractSignRights Then
Else
ActiveWindow.SelectedSheets.Visible = False
End If
End If
End Sub
Private Sub Worksheet_Deactivate()
If Application.StatusBar = "Preview Materials By Category..." Then
Application.StatusBar = False
Else
If hasPreconstructionRights Or hasContractSignRights Then
ActiveWindow.SelectedSheets.Visible = False
Else
End If
End If
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range,
Cancel As Boolean)
Call WorkingsWorksheet_BeforeDoubleClick(Target, Cancel)
End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Excel.Range,
Cancel As Boolean)
Call WorkingsWorksheet_BeforeRightClick(Target, Cancel)
End Sub
Reply With Quote
Chip Pearson
View Public Profile
Find all posts by Chip Pearson