Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 234
Default Calling Private Sub from User Form

Hi,

I have a User Form which when displayed runs a Sub in a module, I want to
set this Sub to Private so that it doesn't show in the Run Macro window.
However, setting to Private causes the Sub to be hidden from the USer Form
and thus, the code fails. Is there a way to set the Sub to Private and
still have it run by code in a User Form.

Thanks in advance for any suggestions. Rob


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Calling Private Sub from User Form

Put it in the userform code module as private.



"Rob" wrote in message
...
Hi,

I have a User Form which when displayed runs a Sub in a module, I want to
set this Sub to Private so that it doesn't show in the Run Macro window.
However, setting to Private causes the Sub to be hidden from the USer Form
and thus, the code fails. Is there a way to set the Sub to Private and
still have it run by code in a User Form.

Thanks in advance for any suggestions. Rob



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 683
Default Calling Private Sub from User Form

I had the same problem a week ago. Put this at the top of your Module. The
sub can be call from the UserForm Code Window, but it will not be seen under
Macros.

Option Private Module

Let me know if this helps

"Rob" wrote:

Hi,

I have a User Form which when displayed runs a Sub in a module, I want to
set this Sub to Private so that it doesn't show in the Run Macro window.
However, setting to Private causes the Sub to be hidden from the USer Form
and thus, the code fails. Is there a way to set the Sub to Private and
still have it run by code in a User Form.

Thanks in advance for any suggestions. Rob


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 234
Default Calling Private Sub from User Form

Brian,

Solution worked a treat, Thank you. Rob

"Brian" wrote in message
...
I had the same problem a week ago. Put this at the top of your Module. The
sub can be call from the UserForm Code Window, but it will not be seen
under
Macros.

Option Private Module

Let me know if this helps

"Rob" wrote:

Hi,

I have a User Form which when displayed runs a Sub in a module, I want to
set this Sub to Private so that it doesn't show in the Run Macro window.
However, setting to Private causes the Sub to be hidden from the USer
Form
and thus, the code fails. Is there a way to set the Sub to Private and
still have it run by code in a User Form.

Thanks in advance for any suggestions. Rob


.



  #5   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 234
Default Calling Private Sub from User Form

Thanks, the solution of putting Option Private Module before all my code did
the job.

"JLGWhiz" wrote in message
...
Put it in the userform code module as private.



"Rob" wrote in message
...
Hi,

I have a User Form which when displayed runs a Sub in a module, I want to
set this Sub to Private so that it doesn't show in the Run Macro window.
However, setting to Private causes the Sub to be hidden from the USer
Form and thus, the code fails. Is there a way to set the Sub to Private
and still have it run by code in a User Form.

Thanks in advance for any suggestions. Rob





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
Improve method of calling a private function in a private module XP Excel Programming 1 April 30th 08 06:41 PM
calling a function in a worksheet from a user form steve Excel Programming 1 January 19th 06 10:00 PM
Calling a Private Sub ben Excel Programming 8 December 8th 04 10:18 PM
Calling a private sub Bob Phillips[_7_] Excel Programming 3 July 29th 04 02:59 AM
Calling variable from user form Geraldon Excel Programming 2 February 9th 04 03:18 PM


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