Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Calling a private sub in Outlook via toolbar button

I need to add a button to my outlook toolbar called "send and file".
This button needs to call a subroutine that will send the message and
allow a user to choose a folder to save the message to (other than the
sent items). My subroutine is working correctly. However, I am unable
to link it to the toolbar because it is a private subroutine. How can
I trigger a private subroutine from a toolbar button?

Thanks very much for your help!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Calling a private sub in Outlook via toolbar button

Hi sapphire,

sapphire wrote:
I need to add a button to my outlook toolbar called "send and file".
This button needs to call a subroutine that will send the message and
allow a user to choose a folder to save the message to (other than the
sent items). My subroutine is working correctly. However, I am
unable to link it to the toolbar because it is a private subroutine.
How can I trigger a private subroutine from a toolbar button?


I assume you're talking about Outlook VBA, not Excel. Regardless, there's
no way to call a Private subroutine from any location other than the module
itself. So you'd either need a Public wrapper subroutine, or you'll need to
make your routine Public. What's the reason for making it Private? If it's
to keep users from seeing it in a run macros dialog, you can use Option
Private Module at the top of the code module, which will hide it from that
dialog. (not sure if this applies to Outlook)

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Calling a private sub in Outlook via toolbar button

Can you give me an example of a Public wrapper subroutine?


Jake Marx wrote:
Hi sapphire,

sapphire wrote:
I need to add a button to my outlook toolbar called "send and file".
This button needs to call a subroutine that will send the message and
allow a user to choose a folder to save the message to (other than the
sent items). My subroutine is working correctly. However, I am
unable to link it to the toolbar because it is a private subroutine.
How can I trigger a private subroutine from a toolbar button?


I assume you're talking about Outlook VBA, not Excel. Regardless, there's
no way to call a Private subroutine from any location other than the module
itself. So you'd either need a Public wrapper subroutine, or you'll need to
make your routine Public. What's the reason for making it Private? If it's
to keep users from seeing it in a run macros dialog, you can use Option
Private Module at the top of the code module, which will hide it from that
dialog. (not sure if this applies to Outlook)

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Calling a private sub in Outlook via toolbar button

Can you give me an example of a Public wrapper subroutine?

Thanks much.


Jake Marx wrote:
Hi sapphire,

sapphire wrote:
I need to add a button to my outlook toolbar called "send and file".
This button needs to call a subroutine that will send the message and
allow a user to choose a folder to save the message to (other than the
sent items). My subroutine is working correctly. However, I am
unable to link it to the toolbar because it is a private subroutine.
How can I trigger a private subroutine from a toolbar button?


I assume you're talking about Outlook VBA, not Excel. Regardless, there's
no way to call a Private subroutine from any location other than the module
itself. So you'd either need a Public wrapper subroutine, or you'll need to
make your routine Public. What's the reason for making it Private? If it's
to keep users from seeing it in a run macros dialog, you can use Option
Private Module at the top of the code module, which will hide it from that
dialog. (not sure if this applies to Outlook)

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Calling a private sub in Outlook via toolbar button

sapphire wrote:
Can you give me an example of a Public wrapper subroutine?

Thanks much.


All I was talking about was creating a Public subroutine that in turn called
the Private one (from the same Module of course).

Public Sub MyWrapper()
DoMyStuff True
End Sub

Private Sub DoMyStuff(dummyVar As Boolean)
'/ your code here
End Sub

But why are is your subroutine Private in the first place if you want it to
be globally callable?

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Calling a private sub in Outlook via toolbar button

It's private because when I type, for example:
Public Sub MyWrapper() and I include something in the () - (var as
Boolean), it automatically makes it a private sub.

Thanks.

Jake Marx wrote:
sapphire wrote:
Can you give me an example of a Public wrapper subroutine?

Thanks much.


All I was talking about was creating a Public subroutine that in turn called
the Private one (from the same Module of course).

Public Sub MyWrapper()
DoMyStuff True
End Sub

Private Sub DoMyStuff(dummyVar As Boolean)
'/ your code here
End Sub

But why are is your subroutine Private in the first place if you want it to
be globally callable?

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]


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
Calling a private macro Nick Smith[_2_] Excel Programming 5 June 8th 06 12:03 PM
Calling Private Sub/Function AMK4[_36_] Excel Programming 5 February 4th 06 01:47 AM
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 private subs dunlklee Excel Programming 1 December 16th 03 08:40 AM


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