Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel 2000: maximise a sizeable form?
Hello all
I have set a form to be resizeable, and I would like to give my users the opportunity to choose to have this form to start in a maximised state. How would I do that? Thanks BTW I just realised that I am crossposting with the microsoft.public.office.developer.vba newsgroup. My fault, my apologies to all. Philippe http://uk.geocities.com/philippeoget |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel 2000: maximise a sizeable form?
Basically you need an independent place to store data that
your macro can draw from each time it starts. Here's one way to do what you are looking for. See my further comments at the end. Sub MainMacro() On Error GoTo 88 Workbooks.Open Filename:= _ "C:\Documents and Settings\My Documents\UserPrefs.xls" UserForm1.Height = Range("A1").Value UserForm1.Width = Range("A2").Value Application.DisplayAlerts = False ActiveWorkbook.Close Application.DisplayAlerts = True If NeverTrue = 3.14 Then 88 UserForm1.Height = 50 UserForm1.Width = 125 End If UserForm1.Show End Sub Private Sub Maximize_Click() On Error GoTo 99 Workbooks.Open Filename:= _ "C:\Documents and Settings\My Documents\UserPrefs.xls" If NeverTrue = 3.14 Then 99 Workbooks.Add ActiveWorkbook.SaveAs Filename:= _ "C:\Documents and Settings\My Documents\UserPrefs.xls", FileFormat:= _ xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False _ , CreateBackup:=False End If Range("A1").Value = 200 Range("A2").Value = 200 UserForm1.Height = 200 UserForm1.Width = 200 ActiveWorkbook.Save Application.DisplayAlerts = False ActiveWorkbook.Close Application.DisplayAlerts = True End Sub Private Sub Minimize_Click() On Error GoTo 99 Workbooks.Open Filename:= _ "C:\Documents and Settings\My Documents\UserPrefs.xls" If NeverTrue = 3.14 Then 99 Workbooks.Add ActiveWorkbook.SaveAs Filename:= _ "C:\Documents and Settings\My Documents\UserPrefs.xls", FileFormat:= _ xlNormal, Password:="", WriteResPassword:="" _ , ReadOnlyRecommended:=False _ , CreateBackup:=False End If Range("A1").Value = 50 Range("A2").Value = 125 UserForm1.Height = 50 UserForm1.Width = 125 ActiveWorkbook.Save Application.DisplayAlerts = False ActiveWorkbook.Close Application.DisplayAlerts = True End Sub 1) You could save the "UserPrefs" file anywhere on the user's drive just so long as it will not be deleted or moved. 2) "Maximize"(or -ise) and "Minimize" are the buttons I put on my tester userform. You will need to put that code into the userform code area. I liked that question. Thank you. -IA -----Original Message----- Hello all I have set a form to be resizeable, and I would like to give my users the opportunity to choose to have this form to start in a maximised state. How would I do that? Thanks BTW I just realised that I am crossposting with the microsoft.public.office.developer.vba newsgroup. My fault, my apologies to all. Philippe http://uk.geocities.com/philippeoget . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel window - keyboard shortcut for maximise | Excel Discussion (Misc queries) | |||
how can i print a form/s that are in excel 2000 dataforms? | Excel Discussion (Misc queries) | |||
In excel: when in print preview, 1 button to 'maximise margins' | Excel Worksheet Functions | |||
Accessing the values of form controls on worksheets in Excel 2000 | Excel Programming | |||
Excel 2000 VBA Form Combobox value | Excel Programming |