Call Private Sub

MarkCBB

Active Member
Joined
Apr 12, 2010
Messages
497
HI there,

I am trying to call a piece of code, but I am getting the following error: "Cant execute break in code"

but there is no break in the code, however the code that i am calling is a Private sub with Option Explicit. (Not my code so not sure)

is there a way to do this. here is the code that I am using

Code:
Sub Send()
Sheets("sender").Visible = True
Sheets("sender").Select
Call Sender_Click
End Sub
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
What is the Sender_Click code and where is it located?
 
Upvote 0
The code is located in a worksheet, not module, the code sends out emails. (Code from Ron de Bruin).
 
Upvote 0
Unless both bits of code are in the same worksheet, you cannot call the other sub that way - you need the other sub to be public and you need to refer to is as a amethod of the other sheet:
Code:
Call sheet1.sender_click
for example where sheet1 is the code name, rather than tab name, of the sheet with the code.
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top