Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Module problem

"Pat" wrote in message
.. .
Thank you for helping out. It seems I need to clarify what precisely I
wish
to do. On one sheet (say, sheet1) a custom commandbutton is clicked to
bring
the user to another sheet (say, sheet2). in sheet2 another custom
commandbutton (called, CloseExcelExport) is clicked which runs code. Once
the code has completed the instructions it then ghosts out the button,
hence
the instruction,

Me.CloseExcelExport.Enabled = False

What I want to do is incorporate the code in CloseExcelExport with the
commandbutton in sheet1, but still retain the commandbutton in sheet2.


Hi Pat,

If you want to address a command button called CloseExcelExport, which
is located on Sheet2, from code located in Sheet1 you would do it like so
(assuming the CodeName of the target worksheet is in fact Sheet2):

Sheet2.CloseExcelExport.Enabled = False

If you want this button and a button on Sheet1 to call the same code,
there are several ways to do it. The easiest would be to create a new method
(Public Sub) in Sheet2 and call it from both places. If you have the
following in Sheet2:

Public Sub MyMethod()
''' Your code here
End Sub

You can call it from Sheet1 like so:

Sheet2.MyMethod

And it can be called from within Sheet2 like any other subroutine.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm


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
module problem robert Vetrano Excel Worksheet Functions 2 February 28th 11 12:21 PM
Problem with Auto Close module Kevin Excel Discussion (Misc queries) 1 January 10th 08 11:24 PM
Problem copying worksheet containing code module Basie[_2_] Excel Programming 1 September 3rd 03 12:28 AM
Userform with template class module problem Tom Ogilvy Excel Programming 1 July 18th 03 09:15 PM
Userform with template class module problem Tom Ogilvy Excel Programming 0 July 17th 03 06:38 PM


All times are GMT +1. The time now is 04:11 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"