Error in Executing a simple macro

YCJ

New Member
Joined
Feb 28, 2011
Messages
29
Hi all

I'm kinda puzzled by this issue. My macro works great in my own pc, it is a report generator, I tested it on another 2 pc, no problems at all, however, when I used it on one particular pc, this execution fails.
Code:
Windows(fileName).Activate
I looked at it, there wasn't any problem at all. The windows with the title fileName is already opened, I just wanted to activate it because I was copying data from another window. The fileName has no error, however it just won't work. Other pc works just fine. It wasn't microsoft excel version difference anyway, we were using the same version in the office. The error is Run Time error 9: Subscript out of range. I don't know exactly how this happen. Help is very much appreciated.

Thanks for your time,
CJ
 
Last edited:

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Just a guess...but some people choose to hide extensions of files of a known type, and others choose to show the extensions. Take a look at the entire window name...see if there's a difference between the entire displayed filename in the banner.
 
Upvote 0
Thanks a lot! You solved my problem, it seems that it was the extension problem that caused the issue. :biggrin:

Have a nice day,
CJ
 
Upvote 0
It's fairly rare that you ever need to refer to workbooks via Windows() - if you use Workbooks() instead you should avoid this problem
 
Upvote 0
Oh, meaning if I use Workbooks(), it would not care about it's extensions at all?

CJ
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,261
Members
452,901
Latest member
LisaGo

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