Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Connecting Modules in VBA

I have 3 worksheets, 1 is results, 1 is calculation, and the 3rd is the data
input interface. On the third I have buttons that need to execute and update
field command. I can't get the button to work, when I run the program in VBA
it can't find the function I am trying to call because it is a different
module. I've tried sharing it, and making it public.... any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Connecting Modules in VBA

Hi Jenny,

Try posting your button code and, possibly, the function.

---
Regards,
Norman



"Jenny" wrote in message
...
I have 3 worksheets, 1 is results, 1 is calculation, and the 3rd is the
data
input interface. On the third I have buttons that need to execute and
update
field command. I can't get the button to work, when I run the program in
VBA
it can't find the function I am trying to call because it is a different
module. I've tried sharing it, and making it public.... any ideas?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Connecting Modules in VBA

Hi,
So, this is my button code, I keep getting error 9 on the 4th line:

Sub CommandButton1_Click()
Dim button1 As Module
Set button1 = Modules!["calc"]
CommandButton1.Caption = "refresh critical ratio table"
button1
End Sub

"calc" is the name of the module I need to access, within that module is a
sub procedure called "valuesearch" that needs to run on command.

Thanks!
"Norman Jones" wrote:

Hi Jenny,

Try posting your button code and, possibly, the function.

---
Regards,
Norman



"Jenny" wrote in message
...
I have 3 worksheets, 1 is results, 1 is calculation, and the 3rd is the
data
input interface. On the third I have buttons that need to execute and
update
field command. I can't get the button to work, when I run the program in
VBA
it can't find the function I am trying to call because it is a different
module. I've tried sharing it, and making it public.... any ideas?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Connecting Modules in VBA

Hi Jenny,

Try:
'==============
Sub CommandButton1_Click()
CommandButton1.Caption = "refresh critical ratio table"
Call ValueSearch
End Sub
'<<==============


---
Regards,
Norman


"Jenny" wrote in message
...
Hi,
So, this is my button code, I keep getting error 9 on the 4th line:

Sub CommandButton1_Click()
Dim button1 As Module
Set button1 = Modules!["calc"]
CommandButton1.Caption = "refresh critical ratio table"
button1
End Sub

"calc" is the name of the module I need to access, within that module is a
sub procedure called "valuesearch" that needs to run on command.

Thanks!
"Norman Jones" wrote:

Hi Jenny,

Try posting your button code and, possibly, the function.

---
Regards,
Norman



"Jenny" wrote in message
...
I have 3 worksheets, 1 is results, 1 is calculation, and the 3rd is the
data
input interface. On the third I have buttons that need to execute and
update
field command. I can't get the button to work, when I run the program
in
VBA
it can't find the function I am trying to call because it is a
different
module. I've tried sharing it, and making it public.... any ideas?






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Connecting Modules in VBA

Hi again,
So, I am definitely getting closer, but now the sub function is not defined,
specifically valuesearch. How can I define it?

Jenny

"Norman Jones" wrote:

Hi Jenny,

Try:
'==============
Sub CommandButton1_Click()
CommandButton1.Caption = "refresh critical ratio table"
Call ValueSearch
End Sub
'<<==============


---
Regards,
Norman


"Jenny" wrote in message
...
Hi,
So, this is my button code, I keep getting error 9 on the 4th line:

Sub CommandButton1_Click()
Dim button1 As Module
Set button1 = Modules!["calc"]
CommandButton1.Caption = "refresh critical ratio table"
button1
End Sub

"calc" is the name of the module I need to access, within that module is a
sub procedure called "valuesearch" that needs to run on command.

Thanks!
"Norman Jones" wrote:

Hi Jenny,

Try posting your button code and, possibly, the function.

---
Regards,
Norman



"Jenny" wrote in message
...
I have 3 worksheets, 1 is results, 1 is calculation, and the 3rd is the
data
input interface. On the third I have buttons that need to execute and
update
field command. I can't get the button to work, when I run the program
in
VBA
it can't find the function I am trying to call because it is a
different
module. I've tried sharing it, and making it public.... any ideas?








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Connecting Modules in VBA

Hi Jenny,

(1) Check that the macro name is spelled correctly.
(2) Is the macro in a standard module in the same workbook as the
command button?
(3) Where is the command button code?


---
Regards,
Norman


"Jenny" wrote in message
...
Hi again,
So, I am definitely getting closer, but now the sub function is not
defined,
specifically valuesearch. How can I define it?

Jenny

"Norman Jones" wrote:

Hi Jenny,

Try:
'==============
Sub CommandButton1_Click()
CommandButton1.Caption = "refresh critical ratio table"
Call ValueSearch
End Sub
'<<==============


---
Regards,
Norman


"Jenny" wrote in message
...
Hi,
So, this is my button code, I keep getting error 9 on the 4th line:

Sub CommandButton1_Click()
Dim button1 As Module
Set button1 = Modules!["calc"]
CommandButton1.Caption = "refresh critical ratio table"
button1
End Sub

"calc" is the name of the module I need to access, within that module
is a
sub procedure called "valuesearch" that needs to run on command.

Thanks!
"Norman Jones" wrote:

Hi Jenny,

Try posting your button code and, possibly, the function.

---
Regards,
Norman



"Jenny" wrote in message
...
I have 3 worksheets, 1 is results, 1 is calculation, and the 3rd is
the
data
input interface. On the third I have buttons that need to execute
and
update
field command. I can't get the button to work, when I run the
program
in
VBA
it can't find the function I am trying to call because it is a
different
module. I've tried sharing it, and making it public.... any ideas?








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Connecting Modules in VBA

Hi Norman,
Yeah, I copy and pasted the name to make sure it wasn't misspelt, I am only
dealing with one 3 worksheet workbook, and... this might be it.... the
command button code is in the module for the worksheet that contains the
command button, should it be in the same module as the procedure I am trying
to call?
Thanks!
Jenny

"Norman Jones" wrote:

Hi Jenny,

(1) Check that the macro name is spelled correctly.
(2) Is the macro in a standard module in the same workbook as the
command button?
(3) Where is the command button code?


---
Regards,
Norman


"Jenny" wrote in message
...
Hi again,
So, I am definitely getting closer, but now the sub function is not
defined,
specifically valuesearch. How can I define it?

Jenny

"Norman Jones" wrote:

Hi Jenny,

Try:
'==============
Sub CommandButton1_Click()
CommandButton1.Caption = "refresh critical ratio table"
Call ValueSearch
End Sub
'<<==============


---
Regards,
Norman


"Jenny" wrote in message
...
Hi,
So, this is my button code, I keep getting error 9 on the 4th line:

Sub CommandButton1_Click()
Dim button1 As Module
Set button1 = Modules!["calc"]
CommandButton1.Caption = "refresh critical ratio table"
button1
End Sub

"calc" is the name of the module I need to access, within that module
is a
sub procedure called "valuesearch" that needs to run on command.

Thanks!
"Norman Jones" wrote:

Hi Jenny,

Try posting your button code and, possibly, the function.

---
Regards,
Norman



"Jenny" wrote in message
...
I have 3 worksheets, 1 is results, 1 is calculation, and the 3rd is
the
data
input interface. On the third I have buttons that need to execute
and
update
field command. I can't get the button to work, when I run the
program
in
VBA
it can't find the function I am trying to call because it is a
different
module. I've tried sharing it, and making it public.... any ideas?









  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Connecting Modules in VBA

Hi Jenny,

I opened a new workbook.
On sheet2 I added a button from the Control Toolbox. I right-clicked the
command button and pasted:

'==============
Sub CommandButton1_Click()
CommandButton1.Caption = "refresh critical ratio table"
Call ValueSearch
End Sub
'<<==============

From the VBE menus:

Tools | Insert | Module

and I pasted:

'==============
Public Sub ValueSearch()
MsgBox "HELLO"
End Sub
'<<==============

Of course, in your macro, the MsgBox line will be replaced with other
instructions.

I returned to the button sheet and clicked the button: The button's caption
was changed and the Hello message appeared.

Your experience should not differ materially.

---
Regards,
Norman



"Jenny" wrote in message
...
Hi Norman,
Yeah, I copy and pasted the name to make sure it wasn't misspelt, I am
only
dealing with one 3 worksheet workbook, and... this might be it.... the
command button code is in the module for the worksheet that contains the
command button, should it be in the same module as the procedure I am
trying
to call?
Thanks!
Jenny

"Norman Jones" wrote:

Hi Jenny,

(1) Check that the macro name is spelled correctly.
(2) Is the macro in a standard module in the same workbook as the
command button?
(3) Where is the command button code?


---
Regards,
Norman


"Jenny" wrote in message
...
Hi again,
So, I am definitely getting closer, but now the sub function is not
defined,
specifically valuesearch. How can I define it?

Jenny

"Norman Jones" wrote:

Hi Jenny,

Try:
'==============
Sub CommandButton1_Click()
CommandButton1.Caption = "refresh critical ratio table"
Call ValueSearch
End Sub
'<<==============


---
Regards,
Norman


"Jenny" wrote in message
...
Hi,
So, this is my button code, I keep getting error 9 on the 4th line:

Sub CommandButton1_Click()
Dim button1 As Module
Set button1 = Modules!["calc"]
CommandButton1.Caption = "refresh critical ratio table"
button1
End Sub

"calc" is the name of the module I need to access, within that
module
is a
sub procedure called "valuesearch" that needs to run on command.

Thanks!
"Norman Jones" wrote:

Hi Jenny,

Try posting your button code and, possibly, the function.

---
Regards,
Norman



"Jenny" wrote in message
...
I have 3 worksheets, 1 is results, 1 is calculation, and the 3rd
is
the
data
input interface. On the third I have buttons that need to
execute
and
update
field command. I can't get the button to work, when I run the
program
in
VBA
it can't find the function I am trying to call because it is a
different
module. I've tried sharing it, and making it public.... any
ideas?











  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Connecting Modules in VBA

Thanks! You're wonderful!

"Norman Jones" wrote:

Hi Jenny,

I opened a new workbook.
On sheet2 I added a button from the Control Toolbox. I right-clicked the
command button and pasted:

'==============
Sub CommandButton1_Click()
CommandButton1.Caption = "refresh critical ratio table"
Call ValueSearch
End Sub
'<<==============

From the VBE menus:

Tools | Insert | Module

and I pasted:

'==============
Public Sub ValueSearch()
MsgBox "HELLO"
End Sub
'<<==============

Of course, in your macro, the MsgBox line will be replaced with other
instructions.

I returned to the button sheet and clicked the button: The button's caption
was changed and the Hello message appeared.

Your experience should not differ materially.

---
Regards,
Norman



"Jenny" wrote in message
...
Hi Norman,
Yeah, I copy and pasted the name to make sure it wasn't misspelt, I am
only
dealing with one 3 worksheet workbook, and... this might be it.... the
command button code is in the module for the worksheet that contains the
command button, should it be in the same module as the procedure I am
trying
to call?
Thanks!
Jenny

"Norman Jones" wrote:

Hi Jenny,

(1) Check that the macro name is spelled correctly.
(2) Is the macro in a standard module in the same workbook as the
command button?
(3) Where is the command button code?


---
Regards,
Norman


"Jenny" wrote in message
...
Hi again,
So, I am definitely getting closer, but now the sub function is not
defined,
specifically valuesearch. How can I define it?

Jenny

"Norman Jones" wrote:

Hi Jenny,

Try:
'==============
Sub CommandButton1_Click()
CommandButton1.Caption = "refresh critical ratio table"
Call ValueSearch
End Sub
'<<==============


---
Regards,
Norman


"Jenny" wrote in message
...
Hi,
So, this is my button code, I keep getting error 9 on the 4th line:

Sub CommandButton1_Click()
Dim button1 As Module
Set button1 = Modules!["calc"]
CommandButton1.Caption = "refresh critical ratio table"
button1
End Sub

"calc" is the name of the module I need to access, within that
module
is a
sub procedure called "valuesearch" that needs to run on command.

Thanks!
"Norman Jones" wrote:

Hi Jenny,

Try posting your button code and, possibly, the function.

---
Regards,
Norman



"Jenny" wrote in message
...
I have 3 worksheets, 1 is results, 1 is calculation, and the 3rd
is
the
data
input interface. On the third I have buttons that need to
execute
and
update
field command. I can't get the button to work, when I run the
program
in
VBA
it can't find the function I am trying to call because it is a
different
module. I've tried sharing it, and making it public.... any
ideas?












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
Public, Private, Event modules, Forms modules,,, Jim May Excel Programming 11 October 31st 05 03:12 AM
Basic question - modules and class modules - what's the difference? Mark Stephens[_3_] Excel Programming 9 May 8th 05 11:48 AM
When to code in sheet or userform modules and when to use modules Tony James Excel Programming 1 December 16th 04 10:02 PM
Need Help Connecting To DB J.Adams Excel Programming 3 May 31st 04 06:34 PM
Class Modules vs Modules Jeff Marshall Excel Programming 2 September 28th 03 07:57 PM


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