ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run Time Error on activate coding (https://www.excelbanter.com/excel-programming/387723-run-time-error-activate-coding.html)

Cammy

Run Time Error on activate coding
 
I have a macro with a piece of coding in it that has always worked in the
past. It is a simple command to activate a workbook or a worksheet within a
workbook.
For example
Workbooks("VAR Calc").Activate
or Workbooks("VAR Calc").Worksheets("Historical VaR").Activate
but now when I try and run the macro I get this very strange error message
"Run time error '-2147352565 (8002000b)': Can't move focus to the control
because it is invisible, not enabled, or of a type that does not accept the
focus."
and when I debug it shows that it gets stuck on the activation code.
this is even more stragne a if I run the macro on another computer it seems
to work. Any comments will be greatfully received.

NickHK

Run Time Error on activate coding
 
Referenceing workbooks without their extension (e.g. .xls), as in:
Workbooks("VAR Calc").Activate
will work on machines that have the Windows setting Folder Options View
"Hide file extensions for known types" checked.
However, this gives a subscript out of range error.

What do you get for
?Workbooks("VAR Calc").Windows(1).Visible

NickHK

"Cammy" wrote in message
...
I have a macro with a piece of coding in it that has always worked in the
past. It is a simple command to activate a workbook or a worksheet within

a
workbook.
For example
Workbooks("VAR Calc").Activate
or Workbooks("VAR Calc").Worksheets("Historical VaR").Activate
but now when I try and run the macro I get this very strange error message
"Run time error '-2147352565 (8002000b)': Can't move focus to the control
because it is invisible, not enabled, or of a type that does not accept

the
focus."
and when I debug it shows that it gets stuck on the activation code.
this is even more stragne a if I run the macro on another computer it

seems
to work. Any comments will be greatfully received.




Cammy

Run Time Error on activate coding
 
thanks Nick I have changed my settings and this solves the problem now.
:)

"NickHK" wrote:

Referenceing workbooks without their extension (e.g. .xls), as in:
Workbooks("VAR Calc").Activate
will work on machines that have the Windows setting Folder Options View
"Hide file extensions for known types" checked.
However, this gives a subscript out of range error.

What do you get for
?Workbooks("VAR Calc").Windows(1).Visible

NickHK

"Cammy" wrote in message
...
I have a macro with a piece of coding in it that has always worked in the
past. It is a simple command to activate a workbook or a worksheet within

a
workbook.
For example
Workbooks("VAR Calc").Activate
or Workbooks("VAR Calc").Worksheets("Historical VaR").Activate
but now when I try and run the macro I get this very strange error message
"Run time error '-2147352565 (8002000b)': Can't move focus to the control
because it is invisible, not enabled, or of a type that does not accept

the
focus."
and when I debug it shows that it gets stuck on the activation code.
this is even more stragne a if I run the macro on another computer it

seems
to work. Any comments will be greatfully received.






All times are GMT +1. The time now is 03:17 PM.

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