Running vb script in windows on open spreadsheet

stu1811

New Member
Joined
Oct 19, 2006
Messages
28
Everyday I get an email with a spreadsheet. Instead of pasting in my vb code into the macro editor, I want run a vb script from windows on the spreadsheet. Since the spreadsheet's name changes with the date, I thought it would be easiest to look for an active excel window. Any other suggestions are welcome.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Why can't you just run the code from Excel?

You could have a workbook that only contains the code.
 
Upvote 0
Just put the code in a workbook and run it.

Code can refer to other worksheets/workbooks.
 
Upvote 0
How do I run code from another workbook? It doesnt show up as an option when I goto run macro
 
Upvote 0
I think you need to explain further exactly what you want to do.

Maybe I'm missing something.:eek:

What I'm suggesting is to have a workbook with the code in it.

The code in that workbook would be used to open the other workbook and then do whatever it is you want to do to it.
 
Upvote 0
I want to open an excel file and run a macro.
The tricky part: The file name changes daily and each sheet is its own workgroup.
 
Upvote 0
Well you could do this from another workbook.

But do give specific advice would require more information.

Where is the workbook located?

How does the name change?
 
Upvote 0

Forum statistics

Threads
1,214,942
Messages
6,122,367
Members
449,080
Latest member
Armadillos

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