prevent window resizing and hide title bar

P

Pablo

hello:

how do I prevent users from resizing a window and hiding the title
bar?

I've created a simple conversion calculator and I want it to stay at
the size it is so unknowing users won't resize it and cause confusion.

They can move it anywhere they want, just wnat to keep it in it's
little window

also, if I can take the title bar off, that be great too!
 
G

Gord Dibben

Pablo

First, save a copy of your workbook under a different name so's you have a
backup in the event something mucks up.

Then, with your workbook open.......

Right-click on the Excel Icon just left of "File" on menu bar and select
"View Code"

You are now in the ThisWorkbook module of your workbook.

Copy/paste these two macros in there.

Private Sub Workbook_Open()
ActiveWindow.Caption = "My Calculator"
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWindow.Caption = ""
End Sub

ALT + Q to go back to Excel.

Size the window the way you wish then Protect the Workbook under
Tools>Protection>Protect Workbook.

Save and close.

Re-open to see results.

Gord Dibben Excel MVP
 
P

Pablo

Gord:

Thanks for the info. I also have a macro to close the workbook. It is:

Sub Close_Conversions()

Windows("Conversions.xls").Activate
ActiveWindow.Close

End Sub

However, with the protection on (both structure & windows), I get an
error message saying "Close method of Windows class failed" and in the
VBE the "ActiveWindow.close" line is highlighted. This only happens
with the window protection on; however, I need it b/c I don't want
users re-sizing the window. I also don't need everything it does; for
example, I don't care if they move the window, just don't want it
resized.

Any thoughts?
 
P

Pablo

Scratch that last request. Changed code to:

ActiveWorkbook.Close

and works great now!

thanks again!
 

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

Top