There is a user security setting that will stop your code from running if they
don't allow this type of access.
I think it's a much better idea to use that hidden sheet within the workbook --
or even add a worksheet (that already has the code) from a template workbook.
But there may be another option.
Can you tie into the workbook event: Workbook_SheetBeforeDoubleClick
You might need to check something to know when to continue (a key header in a
key cell or a hidden sheet level name or ???).
If the code is pretty much the same for all your sheets that need this, it may
be easier to maintain.
King Albert II wrote:
Peter,
When the user doubleclicks the evented worksheet, the handler checks if a
particular column is doubleclicked, and if yes proceeds to load a form in
memory and populates that with row info.
The evented sheet has too many columns to fit on a 21" screen. In the row
of the clicked cell, there are some cells that need to be visualized
closely together, so I use a form with some controls.
What I wanted to do was create a sheet from scratch using
....Worksheets.Add, and then attach an event to it. Similar to adding
clickable DOM objects to a html page.
After posting here I discovered a page by Chip Pearson explaining how to,
but it is too involved for this project. Since I only need to add one
worksheet in this particular subroutine, I'll go easy and unhide an
existing sheet, with a hardcoded eventhandler. For the enduser it's the
same magic.
thx for your help
Ward
See "Creating An Event Procedure" here :
http://www.cpearson.com/excel/vbe.aspx ,
"Peter T" <peter_t@discussions wrote in
:
Not sure what you are asking, and what the relevance of the
DoubleClick event is. Maybe you simply want something like this
Private Sub Workbook_NewSheet(ByVal Sh As Object)
If TypeName(Sh) = "Worksheet" Then
Set gwsUpload = Sh
MsgBox Sh.Name & " assigned to gwsUpLoad"
' code ?
End If
End Sub
I am assuming gwsUpload is a global worksheet variable declared in a
normal module
If(?) you have a Form Ingave showing it might be better to update a
Property in the Form and call some routine in the Form.
Regards,
Peter T
"King Albert II" wrote in message
6.253...
Hi,
I'd like to attach the eventhandler below, to any sheet that I add in
code like so : Set wsUpload = ThisWorkbook.Worksheets.Add
Private Sub Worksheet_BeforeDoubleClick(ByVal target As Range, Cancel
As Boolean)
Call bereikenmaken
If target.Column = Range("womschrijving").Column Then
Load Ingave
Call tonen(target)
Ingave.Show
End If
End Sub
How can I do that ?
thx
Ward
--
Dave Peterson