Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I insert template in new sheet of pre-existing excel file? frustrated Excel Worksheet Functions 5 March 30th 07 08:12 PM
how do i insert a code bar or link to a adobe designer file Luis Arechiga Excel Worksheet Functions 1 December 19th 05 02:10 AM
auto file path update when excel sheet moved to another directory. GNSBoy Excel Discussion (Misc queries) 1 August 31st 05 07:46 PM
insert query into excell sheet to update excell sheet and pivot table vbsolo Excel Discussion (Misc queries) 0 August 24th 05 12:41 PM
Macro to insert values from a file and save another sheet as a .txt file Frank[_16_] Excel Programming 2 August 28th 03 01:07 AM


All times are GMT +1. The time now is 01:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"