Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Is it possible to run a macro from module1, which calls/runs a private sub in module2. Thanks Richard |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Pretty sure the answer's no - you'd have to make it a public sub
"Richard" wrote: Hi, Is it possible to run a macro from module1, which calls/runs a private sub in module2. Thanks Richard |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sam
Not the answer I was hoping for, but thanks anyway. Thought I was missing something really obvious. Regards Richard "Sam Wilson" wrote: Pretty sure the answer's no - you'd have to make it a public sub "Richard" wrote: Hi, Is it possible to run a macro from module1, which calls/runs a private sub in module2. Thanks Richard |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there a reason you don't want to have a public sub? There may be another
way round the problem. "Richard" wrote: Sam Not the answer I was hoping for, but thanks anyway. Thought I was missing something really obvious. Regards Richard "Sam Wilson" wrote: Pretty sure the answer's no - you'd have to make it a public sub "Richard" wrote: Hi, Is it possible to run a macro from module1, which calls/runs a private sub in module2. Thanks Richard |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Really it's only to keep everything nice and tidy, so that when another user
has to use the workbook and run a macro there is less chance of the wrong this being run. I can easily keep the macros within the same module, but this is a little cumbersome when updating code. "Sam Wilson" wrote: Is there a reason you don't want to have a public sub? There may be another way round the problem. "Richard" wrote: Sam Not the answer I was hoping for, but thanks anyway. Thought I was missing something really obvious. Regards Richard "Sam Wilson" wrote: Pretty sure the answer's no - you'd have to make it a public sub "Richard" wrote: Hi, Is it possible to run a macro from module1, which calls/runs a private sub in module2. Thanks Richard |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could put a dummy parameter in the sub you would rather keep private:
Public Sub test(ByVal dummy As String) MsgBox "Hello" End Sub This won't then be visible to anyone wanting to run a macro from outside the VBE window, and if you want to call it from another macro you can pass a dummy parameter: sub demo call test("X") end sub "Richard" wrote: Really it's only to keep everything nice and tidy, so that when another user has to use the workbook and run a macro there is less chance of the wrong this being run. I can easily keep the macros within the same module, but this is a little cumbersome when updating code. "Sam Wilson" wrote: Is there a reason you don't want to have a public sub? There may be another way round the problem. "Richard" wrote: Sam Not the answer I was hoping for, but thanks anyway. Thought I was missing something really obvious. Regards Richard "Sam Wilson" wrote: Pretty sure the answer's no - you'd have to make it a public sub "Richard" wrote: Hi, Is it possible to run a macro from module1, which calls/runs a private sub in module2. Thanks Richard |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In module1:
Option Explicit Sub testme01() Application.Run "Testme02" End Sub In module2: Option Explicit Private Sub testme02() MsgBox "hey, this is private" End Sub Richard wrote: Hi, Is it possible to run a macro from module1, which calls/runs a private sub in module2. Thanks Richard -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Call a Private Sub using a variable | Excel Programming | |||
Improve method of calling a private function in a private module | Excel Programming | |||
How to call a private sub() in another module | Excel Programming | |||
IF Statements-call private sub | Excel Worksheet Functions | |||
Call Private Function from ThisWorkbook module | Excel Programming |