ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel VB, Workbook.activate (https://www.excelbanter.com/excel-programming/285959-excel-vbulletin-workbook-activate.html)

sclark

Excel VB, Workbook.activate
 
I ran into a problem the other day with Activating an Open
workbook in Excel VB. I run this macro everyday, and it
has no problem on MY pc, but fails on most others. The
code is Workbooks("MyBook").Activate, where MyBook is the
workbook that contains the macro. It fails on other pc's
because the name MyBook is not fully qualified to
MyBook.xls. If I fully qualify it, it works on all
machines. Is there an XL setting somewhere that controls
whether the fully qualified name is required or not?

Vasant Nanavati

Excel VB, Workbook.activate
 
I believe it is the Windows setting that controls the behavior. In a Windows
Exlporer window:

Tools | Folder Options | View | Hide file extensions for known file types

--

Vasant



"sclark" wrote in message
...
I ran into a problem the other day with Activating an Open
workbook in Excel VB. I run this macro everyday, and it
has no problem on MY pc, but fails on most others. The
code is Workbooks("MyBook").Activate, where MyBook is the
workbook that contains the macro. It fails on other pc's
because the name MyBook is not fully qualified to
MyBook.xls. If I fully qualify it, it works on all
machines. Is there an XL setting somewhere that controls
whether the fully qualified name is required or not?




slcark

Excel VB, Workbook.activate
 

-----Original Message-----
I believe it is the Windows setting that controls the

behavior. In a Windows
Exlporer window:

Tools | Folder Options | View | Hide file extensions for

known file types

--

Vasant



"sclark" wrote in

message
...
I ran into a problem the other day with Activating an

Open
workbook in Excel VB. I run this macro everyday, and it
has no problem on MY pc, but fails on most others. The
code is Workbooks("MyBook").Activate, where MyBook is

the
workbook that contains the macro. It fails on other

pc's
because the name MyBook is not fully qualified to
MyBook.xls. If I fully qualify it, it works on all
machines. Is there an XL setting somewhere that

controls
whether the fully qualified name is required or not?



.
Thanks for the reply. I tried that and it didn't work.

Not sure if I have to reboot or not (I havent) but it
still fails. Funny thing is that it will OPEN workbooks
without being fully qualified, but it won't activate
them. My other computer does both...I'm certain there
must be a setting somewhere, and the one you suggested
seemed like a likely candidate. I will keep searching.

Steve

Patrick Molloy[_4_]

Excel VB, Workbook.activate
 
Without the full path, excel defaults to its own root directory.

--
Patrick Molloy
Microsoft Excel MVP
----------------------------------
"sclark" wrote in message
...
I ran into a problem the other day with Activating an Open
workbook in Excel VB. I run this macro everyday, and it
has no problem on MY pc, but fails on most others. The
code is Workbooks("MyBook").Activate, where MyBook is the
workbook that contains the macro. It fails on other pc's
because the name MyBook is not fully qualified to
MyBook.xls. If I fully qualify it, it works on all
machines. Is there an XL setting somewhere that controls
whether the fully qualified name is required or not?




Vasant Nanavati

Excel VB, Workbook.activate
 
BTW, it waould be a lot easier to use:

ThisWorkbook.Activate

to activate the workbook containing the macro.

--

Vasant


"slcark" wrote in message
...

-----Original Message-----
I believe it is the Windows setting that controls the

behavior. In a Windows
Exlporer window:

Tools | Folder Options | View | Hide file extensions for

known file types

--

Vasant



"sclark" wrote in

message
...
I ran into a problem the other day with Activating an

Open
workbook in Excel VB. I run this macro everyday, and it
has no problem on MY pc, but fails on most others. The
code is Workbooks("MyBook").Activate, where MyBook is

the
workbook that contains the macro. It fails on other

pc's
because the name MyBook is not fully qualified to
MyBook.xls. If I fully qualify it, it works on all
machines. Is there an XL setting somewhere that

controls
whether the fully qualified name is required or not?



.
Thanks for the reply. I tried that and it didn't work.

Not sure if I have to reboot or not (I havent) but it
still fails. Funny thing is that it will OPEN workbooks
without being fully qualified, but it won't activate
them. My other computer does both...I'm certain there
must be a setting somewhere, and the one you suggested
seemed like a likely candidate. I will keep searching.

Steve




sclark

Excel VB, Workbook.activate
 
What's weird about this, is the macro I'm having a problem
with opens starts with ONE workbook open (the one with the
macro in it), and it opens another which is in a
completely different path (root of C:). On MY pc at work,
it handles BOTH of these just fine without fully
qualifying the name. All other pc's I've tried it on
won't work. Another thing is that the OPEN works fine
without full qualification (obviously the path is
qualified, just not the extension) but the Activate is
where I have the problem. It is EASY to 'fix' (just add
the .xls or .wk3) to the book name on the Activate
command, but I just like to understand WHY that needs to
be done on one computer but not others.

Here is the code:

Application.ScreenUpdating = False

Workbooks.Open Filename:="C:\All_Sirs_Daily"
Workbooks("SIR Status v3.0.xls").Activate

All_Sirs_Daily is a .wk3 file (from lotus notes extract)
and Sir Status v3.0 is the one with the macro. That
Activate will fail if not fully qualified as shown above.
Subsequent Activates on All_Sirs_Daily will also fail
without full qualification.


Steve
-----Original Message-----
Without the full path, excel defaults to its own root

directory.

--
Patrick Molloy
Microsoft Excel MVP
----------------------------------
"sclark" wrote in

message
...
I ran into a problem the other day with Activating an

Open
workbook in Excel VB. I run this macro everyday, and it
has no problem on MY pc, but fails on most others. The
code is Workbooks("MyBook").Activate, where MyBook is

the
workbook that contains the macro. It fails on other

pc's
because the name MyBook is not fully qualified to
MyBook.xls. If I fully qualify it, it works on all
machines. Is there an XL setting somewhere that

controls
whether the fully qualified name is required or not?



.


sclark

Excel VB, Workbook.activate
 
Thanks, I learn somethin new everyday with this stuff.
Never knew about the 'ThisWorkBook' b4.

-----Original Message-----
BTW, it waould be a lot easier to use:

ThisWorkbook.Activate

to activate the workbook containing the macro.

--

Vasant


"slcark" wrote in

message
...

-----Original Message-----
I believe it is the Windows setting that controls the

behavior. In a Windows
Exlporer window:

Tools | Folder Options | View | Hide file extensions

for
known file types

--

Vasant



"sclark" wrote in

message
...
I ran into a problem the other day with Activating an

Open
workbook in Excel VB. I run this macro everyday,

and it
has no problem on MY pc, but fails on most others.

The
code is Workbooks("MyBook").Activate, where MyBook is

the
workbook that contains the macro. It fails on other

pc's
because the name MyBook is not fully qualified to
MyBook.xls. If I fully qualify it, it works on all
machines. Is there an XL setting somewhere that

controls
whether the fully qualified name is required or not?


.
Thanks for the reply. I tried that and it didn't work.

Not sure if I have to reboot or not (I havent) but it
still fails. Funny thing is that it will OPEN workbooks
without being fully qualified, but it won't activate
them. My other computer does both...I'm certain there
must be a setting somewhere, and the one you suggested
seemed like a likely candidate. I will keep searching.

Steve



.


Vasant Nanavati

Excel VB, Workbook.activate
 
"sclark" wrote in message
...
I learn somethin new everyday with this stuff.


Hey, me too! :-)



sclark

Excel VB, Workbook.activate
 
Hmmm. I would understand that if it was having trouble finding the actual path of the file. When I say fully qualify, I am not qualifying the path, just the file extension (xls). This one still stumps m



All times are GMT +1. The time now is 02:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com