Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Calling procedure from another WKB with parameters

I have two wkb's say Book1.xls and book2.xls

from book1 I am calling a procedure(with arguments : Run
"book2.xls!test_msgbox(4,8)"


sub in book 2 is :
Sub test_msgbox(int_1 As Integer, int_2 As Integer)
int_1 = int_1 + 2
int_2 = int_2 + 3
MsgBox int_1 + int_2
End Sub

msgbox comes up twice. It comes up once with result 17 and after i hit OK it
is still there. Second time when i hit OK..msgbox closes.

But if i refer to a procedure without passing any values it works fine.

Any ideas what could be the reason. and how could it be rectified.

Thanks,
Ajit


--
Ajit
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Calling procedure from another WKB with parameters

Ajit,

Try calling like this

Application.Run "book2.xls!test_msgbox", 4, 8

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ajit" wrote in message
...
I have two wkb's say Book1.xls and book2.xls

from book1 I am calling a procedure(with arguments : Run
"book2.xls!test_msgbox(4,8)"


sub in book 2 is :
Sub test_msgbox(int_1 As Integer, int_2 As Integer)
int_1 = int_1 + 2
int_2 = int_2 + 3
MsgBox int_1 + int_2
End Sub

msgbox comes up twice. It comes up once with result 17 and after i hit OK

it
is still there. Second time when i hit OK..msgbox closes.

But if i refer to a procedure without passing any values it works fine.

Any ideas what could be the reason. and how could it be rectified.

Thanks,
Ajit


--
Ajit



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Calling procedure from another WKB with parameters

Bob,

It doesn't make any difference. Still msgbox is coming up twice.

"Bob Phillips" wrote:

Ajit,

Try calling like this

Application.Run "book2.xls!test_msgbox", 4, 8

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ajit" wrote in message
...
I have two wkb's say Book1.xls and book2.xls

from book1 I am calling a procedure(with arguments : Run
"book2.xls!test_msgbox(4,8)"


sub in book 2 is :
Sub test_msgbox(int_1 As Integer, int_2 As Integer)
int_1 = int_1 + 2
int_2 = int_2 + 3
MsgBox int_1 + int_2
End Sub

msgbox comes up twice. It comes up once with result 17 and after i hit OK

it
is still there. Second time when i hit OK..msgbox closes.

But if i refer to a procedure without passing any values it works fine.

Any ideas what could be the reason. and how could it be rectified.

Thanks,
Ajit


--
Ajit




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Calling procedure from another WKB with parameters

I am sorry i didn't looked at the syntax properly earlier. It worked fine.
Thanks!

"Bob Phillips" wrote:

Ajit,

Try calling like this

Application.Run "book2.xls!test_msgbox", 4, 8

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ajit" wrote in message
...
I have two wkb's say Book1.xls and book2.xls

from book1 I am calling a procedure(with arguments : Run
"book2.xls!test_msgbox(4,8)"


sub in book 2 is :
Sub test_msgbox(int_1 As Integer, int_2 As Integer)
int_1 = int_1 + 2
int_2 = int_2 + 3
MsgBox int_1 + int_2
End Sub

msgbox comes up twice. It comes up once with result 17 and after i hit OK

it
is still there. Second time when i hit OK..msgbox closes.

But if i refer to a procedure without passing any values it works fine.

Any ideas what could be the reason. and how could it be rectified.

Thanks,
Ajit


--
Ajit




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Another similar situation

Bob,

Your suggestion yesterday was very helpful. Thanks!

I am caught in another situation working with the same setup. Again i habe
two wkb's : Book1 & Book2. (Both have forms)

from book2.form1 i want to open book1.form1 and also want to make the
changes to listboxes in book1.form1 with respect to selections made in
book2.form1. (Code is written in Book2 i want to make changes with objects in
book1.form1)


if book2.form1.listbox1.value 20 then
book1.form1.listbox1.additem ("20")
else
book1.form1.listbox1.additem ("30")
end if


"Bob Phillips" wrote:

Ajit,

Try calling like this

Application.Run "book2.xls!test_msgbox", 4, 8

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ajit" wrote in message
...
I have two wkb's say Book1.xls and book2.xls

from book1 I am calling a procedure(with arguments : Run
"book2.xls!test_msgbox(4,8)"


sub in book 2 is :
Sub test_msgbox(int_1 As Integer, int_2 As Integer)
int_1 = int_1 + 2
int_2 = int_2 + 3
MsgBox int_1 + int_2
End Sub

msgbox comes up twice. It comes up once with result 17 and after i hit OK

it
is still there. Second time when i hit OK..msgbox closes.

But if i refer to a procedure without passing any values it works fine.

Any ideas what could be the reason. and how could it be rectified.

Thanks,
Ajit


--
Ajit






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Another similar situation

Ajit,

What you need to do is create a little procedure in the second workbook that
opens the form, and another that changes listboxes in that form, etc, and
then call that procedure from your first workbook as we discussed yesterday.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ajit" wrote in message
...
Bob,

Your suggestion yesterday was very helpful. Thanks!

I am caught in another situation working with the same setup. Again i habe
two wkb's : Book1 & Book2. (Both have forms)

from book2.form1 i want to open book1.form1 and also want to make the
changes to listboxes in book1.form1 with respect to selections made in
book2.form1. (Code is written in Book2 i want to make changes with objects

in
book1.form1)


if book2.form1.listbox1.value 20 then
book1.form1.listbox1.additem ("20")
else
book1.form1.listbox1.additem ("30")
end if


"Bob Phillips" wrote:

Ajit,

Try calling like this

Application.Run "book2.xls!test_msgbox", 4, 8

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ajit" wrote in message
...
I have two wkb's say Book1.xls and book2.xls

from book1 I am calling a procedure(with arguments : Run
"book2.xls!test_msgbox(4,8)"


sub in book 2 is :
Sub test_msgbox(int_1 As Integer, int_2 As Integer)
int_1 = int_1 + 2
int_2 = int_2 + 3
MsgBox int_1 + int_2
End Sub

msgbox comes up twice. It comes up once with result 17 and after i hit

OK
it
is still there. Second time when i hit OK..msgbox closes.

But if i refer to a procedure without passing any values it works

fine.

Any ideas what could be the reason. and how could it be rectified.

Thanks,
Ajit


--
Ajit






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 procedure in a procedure Norman Jones Excel Programming 8 August 20th 04 07:53 PM
Calling a procedure in a procedure N10 Excel Programming 2 August 18th 04 12:49 AM
Calling a procedure in a procedure Don Guillett[_4_] Excel Programming 1 August 17th 04 11:31 PM
How to Activate procedure with parameters ivarsb Excel Programming 3 July 27th 04 10:42 AM
Calling a .Net Procedure from a Macro Scott Eguires Excel Programming 0 December 10th 03 10:35 PM


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