Passing Arguments

Fire_Chief

Well-known Member
Joined
Jun 21, 2003
Messages
690
Office Version
  1. 365
Platform
  1. Windows
I am having a terrible time trying to pass an argument from one workboork to another workbook.

I am using the variable (CLOSE_IT) as a string. I want it to hold the value "YES"

In workbook #1 I assign the value "YES" in a sub that opens workbook # 2 but when I run a sub in workbook 2 the value is empty.

I have tried every way i know and everything I read, but it won't work.

I have tried putting the variable in the parenthess of the first sub..........Sub mysub(CLOSE_IT) but excel won't even accept this and the sub will not run when I do this.

I have also dimensioned CLOSE_IT as Public.


Please help.

An example would really help.


Thank You Marty
D1A@aol.com
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
This is not really the best answer, but a temporary solution.
Put your YES in a cell of your workbook #1.

Excel won't "forget" that !

regards,
Erik
 
Upvote 0
I don't know that you can pass an argument from one Workbook to another. What I would do is put all my VB code in one of the workbooks because you CAN pass arguments from one macro to another in the same Workbook and you CAN run VBA code located in one workbook on another open Workbook.
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,431
Members
448,961
Latest member
nzskater

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