![]() |
Userform Error
I have a userform that comes up when the workbook opens. I am randomly
getting an error box come up that says "Microsoft Userform" as the title of the box and "Exception Occurred" as the error message. I click OK, and it goes back to the userform, but when I click on anything else after that, I keep getting the message popping back up and I can't do anything (even close Excel down) without closing down by using the Task Manager. What is causing this error and what can I do to fix it? |
Userform Error
TonTon
Can you show us the code in your form module? DQ |
Userform Error
Its fairly long....
Private Sub CommandButton1_Click() Unload StartUp ChangeoverInformation.Show End Sub Private Sub CommandButton2_Click() Unload StartUp ChoosePress.Show End Sub Private Sub CommandButton3_Click() Sheets("Report Sheet").Unprotect Range("Start").Value = Range("End").Value Sheets("Report Sheet").Protect TextBox3.Value = Format(Range("Five"), "hh:mm:ss") TextBox4.Value = Format(Range("Six"), "hh:mm:ss") TextBox5.Value = Format(Range("Seven"), "hh:mm:ss") TextBox6.Value = Format(Range("Eight"), "hh:mm:ss") End Sub Private Sub CommandButton4_Click() Sheets("Report Sheet").Unprotect Range("Start").Value = Range("End").Value - 7 Sheets("Report Sheet").Protect TextBox3.Value = Format(Range("Five"), "hh:mm:ss") TextBox4.Value = Format(Range("Six"), "hh:mm:ss") TextBox5.Value = Format(Range("Seven"), "hh:mm:ss") TextBox6.Value = Format(Range("Eight"), "hh:mm:ss") End Sub Private Sub CommandButton5_Click() Sheets("Report Sheet").Unprotect Range("Start").Value = Range("End").Value - 30 Sheets("Report Sheet").Protect TextBox3.Value = Format(Range("Five"), "hh:mm:ss") TextBox4.Value = Format(Range("Six"), "hh:mm:ss") TextBox5.Value = Format(Range("Seven"), "hh:mm:ss") TextBox6.Value = Format(Range("Eight"), "hh:mm:ss") End Sub Private Sub ENWD_Click() Unload StartUp MoldChangeoverDataEntrySheet.Show End Sub Private Sub ED_Click() If Password.Value = "aaaaa" Then Call EditData Else End Sub Private Sub EditData() Unload StartUp Sheets("Blank Sheet").Unprotect Sheets("Data Sheet").Unprotect Sheets("Pivot Sheet").Unprotect Sheets("Chart Sheet").Unprotect Sheets("Report Sheet").Unprotect Sheets("Issues Chart").Unprotect End Sub Private Sub EXT_Click() Sheets("Blank Sheet").Protect Sheets("Data Sheet").Protect Sheets("Pivot Sheet").Protect Sheets("Chart Sheet").Protect Sheets("Report Sheet").Protect Sheets("Issues Chart").Protect ActiveWorkbook.Save ThisWorkbook.Close End Sub Private Sub Label16_Click() Unload Me End Sub Private Sub PODR_Click() Sheets("Pivot Sheet").Select Sheets("Pivot Sheet").Unprotect ActiveSheet.PivotTables("PivotTable1").PivotCache. Refresh Sheets("Pivot Sheet").Select Dim b As Long With ActiveSheet b = .Cells(.Rows.Count, "B").End(xlUp).Row End With Range("A4:B" & b - 1).Select Selection.Sort Key1:="R4C2", Order1:=xlDescending, Type:=xlSortValues, _ OrderCustom:=1, Orientation:=xlTopToBottom Dim e As Long With ActiveSheet e = .Cells(.Rows.Count, "E").End(xlUp).Row End With Range("D4:E" & e - 1).Select Selection.Sort Key1:="R4C5", Order1:=xlDescending, Type:=xlSortValues, _ OrderCustom:=1, Orientation:=xlTopToBottom Dim n As Long With ActiveSheet n = .Cells(.Rows.Count, "N").End(xlUp).Row End With Range("M4:N" & n - 1).Select Selection.Sort Key1:="R4C14", Order1:=xlDescending, Type:=xlSortValues, _ OrderCustom:=1, Orientation:=xlTopToBottom Dim r As Long With ActiveSheet r = .Cells(.Rows.Count, "R").End(xlUp).Row End With Range("Q4:R" & r - 1).Select Selection.Sort Key1:="R4C18", Order1:=xlDescending, Type:=xlSortValues, _ OrderCustom:=1, Orientation:=xlTopToBottom Dim v As Long With ActiveSheet v = .Cells(.Rows.Count, "V").End(xlUp).Row End With Range("U4:V" & v - 1).Select Selection.Sort Key1:="R4C22", Order1:=xlDescending, Type:=xlSortValues, _ OrderCustom:=1, Orientation:=xlTopToBottom Sheets("Pivot Sheet").Protect Password:="virtue01" Sheets("Chart Sheet").Select Sheets("Chart Sheet").Unprotect Password:="virtue01" ActiveSheet.ChartObjects("Chart 11").Activate ActiveChart.SeriesCollection(1).Select With Selection.Border .Weight = xlThin .LineStyle = xlAutomatic End With Selection.Shadow = False Selection.InvertIfNegative = False With Selection.Interior .ColorIndex = 49 .Pattern = xlSolid End With ActiveWindow.Visible = False Windows("Mold Changeover Data and Analysis.xls").Activate ActiveSheet.ChartObjects("Chart 13").Activate ActiveChart.SeriesCollection(3).Select With Selection.Border .ColorIndex = 57 .Weight = xlMedium .LineStyle = xlContinuous End With With Selection .MarkerBackgroundColorIndex = 46 .MarkerForegroundColorIndex = 46 .MarkerStyle = xlTriangle .Smooth = False .MarkerSize = 5 .Shadow = False End With With Selection.Border .ColorIndex = 46 .Weight = xlMedium .LineStyle = xlContinuous End With With Selection .MarkerBackgroundColorIndex = 46 .MarkerForegroundColorIndex = 46 .MarkerStyle = xlTriangle .Smooth = False .MarkerSize = 5 .Shadow = False End With ActiveChart.SeriesCollection(2).Select With Selection.Border .ColorIndex = 50 .Weight = xlMedium .LineStyle = xlContinuous End With With Selection .MarkerBackgroundColorIndex = 50 .MarkerForegroundColorIndex = 50 .MarkerStyle = xlSquare .Smooth = False .MarkerSize = 5 .Shadow = False End With ActiveChart.SeriesCollection(1).Select With Selection.Border .ColorIndex = 57 .Weight = xlMedium .LineStyle = xlContinuous End With With Selection .MarkerBackgroundColorIndex = xlAutomatic .MarkerForegroundColorIndex = xlAutomatic .MarkerStyle = xlAutomatic .Smooth = False .MarkerSize = 7 .Shadow = False End With ActiveWindow.Visible = False Windows("Mold Changeover Data and Analysis.xls").Activate ActiveSheet.ChartObjects("Chart 12").Activate ActiveChart.SeriesCollection(1).Select With Selection.Border .Weight = xlThin .LineStyle = xlAutomatic End With Selection.Shadow = False Selection.InvertIfNegative = False With Selection.Interior .ColorIndex = 49 .Pattern = xlSolid End With ActiveWindow.Visible = False Windows("Mold Changeover Data and Analysis.xls").Activate ActiveSheet.ChartObjects("Chart 14").Activate ActiveChart.SeriesCollection(1).Select With Selection.Border .Weight = xlThin .LineStyle = xlAutomatic End With Selection.Shadow = False Selection.InvertIfNegative = False With Selection.Interior .ColorIndex = 49 .Pattern = xlSolid End With ActiveWindow.Visible = False Windows("Mold Changeover Data and Analysis.xls").Activate ActiveSheet.ChartObjects("Chart 15").Activate ActiveChart.SeriesCollection(1).Select With Selection.Border .Weight = xlThin .LineStyle = xlAutomatic End With Selection.Shadow = False Selection.InvertIfNegative = False With Selection.Interior .ColorIndex = 49 .Pattern = xlSolid End With ActiveWindow.Visible = False Windows("Mold Changeover Data and Analysis.xls").Activate ActiveSheet.ChartObjects("Chart 16").Activate ActiveChart.SeriesCollection(1).Select With Selection.Border .Weight = xlThin .LineStyle = xlAutomatic End With Selection.Shadow = False Selection.InvertIfNegative = False With Selection.Interior .ColorIndex = 49 .Pattern = xlSolid End With Range("A1:J36").Select ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True Sheets("Chart Sheet").Protect Sheets("Blank Sheet").Select End Sub Private Sub UserForm_Initialize() Sheets("Report Sheet").Unprotect Range("Start").Value = Range("End").Value Sheets("Report Sheet").Protect TextBox3.Value = Format(Range("Five"), "hh:mm:ss") TextBox4.Value = Format(Range("Six"), "hh:mm:ss") TextBox5.Value = Format(Range("Seven"), "hh:mm:ss") TextBox6.Value = Format(Range("Eight"), "hh:mm:ss") End Sub "dq" wrote: TonTon Can you show us the code in your form module? DQ |
Userform Error
Hallo TonTon,
I've tried to recreate your form, but I don't get any errormessages when I start it. IF the error always occurs when you open the workbook, then the problem is perhaps in the WorkBook_Open event. Can you show us that code to DQ |
Userform Error
I do not actually get the error message when the userform pops up, but rather
only after I have been using it after a little while (no certain amount of time), and I do not get the message every time I use the workbook. That is what is so puzzling about it. "dq" wrote: Hallo TonTon, I've tried to recreate your form, but I don't get any errormessages when I start it. IF the error always occurs when you open the workbook, then the problem is perhaps in the WorkBook_Open event. Can you show us that code to DQ |
All times are GMT +1. The time now is 05:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com