prevent window resizing and hide title bar

  • Thread starter Thread starter Pablo
  • Start date Start date
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!
 
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
 
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?
 
Scratch that last request. Changed code to:

ActiveWorkbook.Close

and works great now!

thanks again!
 
Back
Top