Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Calling a procedure in a procedure | Excel Programming | |||
Calling a procedure in a procedure | Excel Programming | |||
Calling a procedure in a procedure | Excel Programming | |||
How to Activate procedure with parameters | Excel Programming | |||
Calling a .Net Procedure from a Macro | Excel Programming |