Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default Click-event question

Hello. I have a workbook with a single sheet and a click event on that
sheet. The click event opens a different workbook that resides on the
server and runs a procedure that is housed in the newly opened workbook.

When the newly opened macro is executed, I need to know where the
click-event originated from. I have the file owners name in cell A1. I
would like to read the contents of cell A1 (the sheet name will vary with
different files) in the file that houses the click event, and be able to use
that variable in the code in the workbook that the click event opened. Can
this be done?? Thanks.

So basically the click event fires, and the newly opened workbook can pop up
a message box that says "this workbook was opened by <var" where <var is
the value in Cell A1 of the click-event workbook.

Possible??


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Click-event question

Steph,

I have to assume that you put a commandbutton from the Control Toolbox onto
a sheet, since sheets don't have a click event.

If you do have a commandbutton, then you simply use Me, which is the object
containing the code (the worksheet).

Private Sub CommandButton1_Click()
MsgBox Me.Range("A1").Value
End Sub

You can certainly assign that to a variable to be used after the other
workbook is opened.

HTH,
Bernie
MS Excel MVP

"Steph" wrote in message
...
Hello. I have a workbook with a single sheet and a click event on that
sheet. The click event opens a different workbook that resides on the
server and runs a procedure that is housed in the newly opened workbook.

When the newly opened macro is executed, I need to know where the
click-event originated from. I have the file owners name in cell A1. I
would like to read the contents of cell A1 (the sheet name will vary with
different files) in the file that houses the click event, and be able to

use
that variable in the code in the workbook that the click event opened.

Can
this be done?? Thanks.

So basically the click event fires, and the newly opened workbook can pop

up
a message box that says "this workbook was opened by <var" where <var

is
the value in Cell A1 of the click-event workbook.

Possible??




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Click-event question

It depends on how you are starting the macro in the workbook on the server.
If it is a Workbook_Open event macro, then the code would have to look at
all the open workbooks to find one that met some specific criteria (like had
a command button with a specific caption on the activesheet). If you use
Application.Run, you could pass in the value from cell A1 as an argument.
(the procedure started with application.Run would need to be designed to
accept the argument, of course).

--
Regards,
Tom Ogilvy

"Steph" wrote in message
...
Hello. I have a workbook with a single sheet and a click event on that
sheet. The click event opens a different workbook that resides on the
server and runs a procedure that is housed in the newly opened workbook.

When the newly opened macro is executed, I need to know where the
click-event originated from. I have the file owners name in cell A1. I
would like to read the contents of cell A1 (the sheet name will vary with
different files) in the file that houses the click event, and be able to

use
that variable in the code in the workbook that the click event opened.

Can
this be done?? Thanks.

So basically the click event fires, and the newly opened workbook can pop

up
a message box that says "this workbook was opened by <var" where <var

is
the value in Cell A1 of the click-event workbook.

Possible??




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
Double-click event question, part 2 (Excel 97) Bob Wall Excel Programming 1 September 11th 04 03:50 AM
Double-click Event question Bob Wall Excel Programming 2 September 6th 04 03:21 AM
On Click Event?, and how to use Wandering Mage Excel Programming 5 June 7th 04 04:28 PM
Before Right Click event mohsinb[_8_] Excel Programming 10 December 22nd 03 08:47 AM
Click Event Nichevo Excel Programming 2 December 4th 03 04:31 AM


All times are GMT +1. The time now is 11:44 PM.

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

About Us

"It's about Microsoft Excel"