Setting EnableResize = False

  • Thread starter Thread starter BIta
  • Start date Start date
B

BIta

Hello,

I opened a new insatnce of Excel and then I put the followinf code
in the auto_open function

Sub auto_open
ActiveWindow.EnableResize = False
Exit Sub

And then I saved the file and closed it. When I tried to open
it I got a run-time error message:

Application-defined or object-defined error

Did I make something wrong. I don't want the user to be able to
resize the active window in Excel. What should I do?

Thanks,
--Bita
 
You want End Sub not Exit Sub.

The code should work as long as there is an active window. For instance, if
it's hidden for any reason it will fail.

--
Jim
| Hello,
|
| I opened a new insatnce of Excel and then I put the followinf code
| in the auto_open function
|
| Sub auto_open
| ActiveWindow.EnableResize = False
| Exit Sub
|
| And then I saved the file and closed it. When I tried to open
| it I got a run-time error message:
|
| Application-defined or object-defined error
|
| Did I make something wrong. I don't want the user to be able to
| resize the active window in Excel. What should I do?
|
| Thanks,
| --Bita
|
 
Oh, yeah I just remembered the reason that line fails - the window is
maximized! You have to use the WindowState property and set it to xlNormal
before you can set EnableResize.

--
Jim
| You want End Sub not Exit Sub.
|
| The code should work as long as there is an active window. For instance,
if
| it's hidden for any reason it will fail.
|
| --
| Jim
| || Hello,
||
|| I opened a new insatnce of Excel and then I put the followinf code
|| in the auto_open function
||
|| Sub auto_open
|| ActiveWindow.EnableResize = False
|| Exit Sub
||
|| And then I saved the file and closed it. When I tried to open
|| it I got a run-time error message:
||
|| Application-defined or object-defined error
||
|| Did I make something wrong. I don't want the user to be able to
|| resize the active window in Excel. What should I do?
||
|| Thanks,
|| --Bita
||
|
|
 
Thanks Jim a lot. I found another way too:

Application.ActiveWorkbook.Protect Structure:=True, Winodws:=True

Cheers,
--Bita
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top