Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Form display errors
First time through the form (GetUserPrintOptions), displays
correctly. The form displays 4 listboxes and invites the user to highlight any of the boxes that will apply. If the user opts to highlight Q3 or Q4, then a further different form displays a different question for the user to highlight or not. The user is returned to GetUserPrintOptions, and when they are ready will click OK. Problem 1: If user selects a Q3 or Q4 question, then they move to the other form and make their choice. When they return to GetUserPrintOptions, they find that one of their previous choices has been reset! They can repeat their actions, and the routine will run successfully but then: Problem 2: If problem 1 has occurred (and Excel has not then been closed), when they present the GetUserPrintOptions form a second time.... they find that the first of the 4 listboxes is blank! Frustrating for the user, and very annoying for me. I cannot find out my errors, so help would be most welcome, please. Here's the form initialisation code: Option Explicit Private Sub CancelButton_Click() CancelButton.Tag = "Selected" OKButton.Tag = "" GetUserPrintOptions.Hide End Sub Private Sub OKButton_Click() OKButton.Tag = "Selected" CancelButton.Tag = "" GetUserPrintOptions.Hide End Sub Private Sub UserForm_Initialize() 'Fill the ListBoxes With GetUserPrintOptions.ListBox1 .RowSource = "" .AddItem "You want to print EVERY Worksheet in EVERY chosen Workbook" End With With GetUserPrintOptions.ListBox2 .RowSource = "" .AddItem "You will want to hide Column(s)" End With With GetUserPrintOptions.ListBox3 .RowSource = "" .AddItem "You want to include the printing of pages that total '0.00'" End With With GetUserPrintOptions.ListBox4 .RowSource = "" .AddItem "You want to include the printing of pages with no totals" End With End Sub Private Sub ListBox2_Change() Me.Hide 'GetUserPrintOptions.Hide GetUserHideColumnOptions.Show GetUserHideColumnOptions.Hide 'GetUserPrintOptions.Show Me.Show End Sub Private Sub ListBox3_Change() GetUserPrintOptions.Hide GetUserPrintZeroPagesOptions.Show GetUserPrintOptions.Show End Sub Private Sub ListBox4_Change() GetUserPrintOptions.Hide GetUserPrintBlankPagesOptions.Show GetUserPrintOptions.Show End Sub And here's the Module code: With GetUserPrintOptions .Show If .OKButton.Tag = "Selected" Then If .ListBox1.Selected(0) Then Global_PrintAllBooks_Sheets = True End If If .ListBox2.Selected(0) Then HideCols = True With GetUserHideColumnOptions If .ListBox1.Selected(0) = True Then Global_HideSameCols = True End If End With End If If .ListBox3.Selected(0) Then PrintZeroPages = True With GetUserPrintZeroPagesOptions If .ListBox1.Selected(0) = True Then Global_PrintZeroPages = True End If End With End If If .ListBox4.Selected(0) Then PrintBlankPages = True With GetUserPrintBlankPagesOptions If .ListBox1.Selected(0) = True Then Global_PrintBlankPages = True End If End With End If Else 'Cancel Button was pressed so set defaults Global_PrintAllBooks_Sheets = False Global_HideCols = False Global_PrintZeroPages = False Global_PrintBlankPages = False End If End With Unload GetUserPrintOptions Unload GetUserPrintBlankPagesOptions Unload GetUserHideColumnOptions Unload GetUserPrintZeroPagesOptions Regards. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.552 / Virus Database: 344 - Release Date: 15/12/2003 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
display number in form of words | Excel Worksheet Functions | |||
Display Row of Data as Form/Page | Excel Discussion (Misc queries) | |||
Excel Form File Errors | Excel Discussion (Misc queries) | |||
Display form from an VB application in Excel | Excel Discussion (Misc queries) | |||
Display many instances of the same form | Excel Programming |