Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Wont Load
Greetings.
I am running Office 2k on a W2k box with 1 gig of ram and an AMD 2400. I have a worksheet that has some UserForms on it. I have a later version of this same workbook that has the same UserForms on it. In the pursuit of streamlining the app, I eliminated all but one of the UserForms from the later workbook. Now it won't load! I went back to the older workbook and did the same and it works fine!!! I tried to delete and then replaced the Forms folder in the later workbook, but it still did the same, the older workbook still works fine. I keep getting this Microsoft Visual Basic message box: Run-time error '-2147352571 (80020005)': Type mismatch The debug then highlights this code: Private Sub StartInv_Click() Call PasteForm1 MakeNewInvForm1.Show <<< End Sub This is the same code and name that is used in the older version. Does anyone have any idea as to what to do next or where to look for information on this problem? Any help would be most appreciated!!! TIA -Minitman |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Wont Load
Minitman
It looks like you're saying the debugger highlights the Show line. If so, go to Tools - Options - General (in the VBE) and select "Break in Class Modules" in the Error Trapping section. Whenever an error ends on a class instancing line (like Show) it usually means the error is in the class module (the userform module, in this case) but that error trapping isn't set to go there. This will tell you which line is actually causing the error. -- Dick Kusleika MVP - Excel Excel Blog - Daily Dose of Excel www.dicks-blog.com "Minitman" wrote in message ... Greetings. I am running Office 2k on a W2k box with 1 gig of ram and an AMD 2400. I have a worksheet that has some UserForms on it. I have a later version of this same workbook that has the same UserForms on it. In the pursuit of streamlining the app, I eliminated all but one of the UserForms from the later workbook. Now it won't load! I went back to the older workbook and did the same and it works fine!!! I tried to delete and then replaced the Forms folder in the later workbook, but it still did the same, the older workbook still works fine. I keep getting this Microsoft Visual Basic message box: Run-time error '-2147352571 (80020005)': Type mismatch The debug then highlights this code: Private Sub StartInv_Click() Call PasteForm1 MakeNewInvForm1.Show <<< End Sub This is the same code and name that is used in the older version. Does anyone have any idea as to what to do next or where to look for information on this problem? Any help would be most appreciated!!! TIA -Minitman |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Wont Load
Dick,
And all this time I thought I had to hit F8 until I got to the error. Thanks for the tip. (It's a good reminder that if something doesn't work the way I want it to in Excel, it's often because I haven't looked hard enough). Doug "Dick Kusleika" wrote in message ... Minitman It looks like you're saying the debugger highlights the Show line. If so, go to Tools - Options - General (in the VBE) and select "Break in Class Modules" in the Error Trapping section. Whenever an error ends on a class instancing line (like Show) it usually means the error is in the class module (the userform module, in this case) but that error trapping isn't set to go there. This will tell you which line is actually causing the error. -- Dick Kusleika MVP - Excel Excel Blog - Daily Dose of Excel www.dicks-blog.com "Minitman" wrote in message ... Greetings. I am running Office 2k on a W2k box with 1 gig of ram and an AMD 2400. I have a worksheet that has some UserForms on it. I have a later version of this same workbook that has the same UserForms on it. In the pursuit of streamlining the app, I eliminated all but one of the UserForms from the later workbook. Now it won't load! I went back to the older workbook and did the same and it works fine!!! I tried to delete and then replaced the Forms folder in the later workbook, but it still did the same, the older workbook still works fine. I keep getting this Microsoft Visual Basic message box: Run-time error '-2147352571 (80020005)': Type mismatch The debug then highlights this code: Private Sub StartInv_Click() Call PasteForm1 MakeNewInvForm1.Show <<< End Sub This is the same code and name that is used in the older version. Does anyone have any idea as to what to do next or where to look for information on this problem? Any help would be most appreciated!!! TIA -Minitman |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Wont Load
Hey Dick,
Thanks for that advice, that did indeed bring up more information. The VB message box was the same. However, the debugger came up with this: Private Sub UserForm_Initialize() Dim i As Integer Application.ScreenUpdating = False Sheets("CI").Activate lastrow = Range("A65536").End(xlUp).Row For i = 1 To lastrow GetCustInfo_ListBox_01_04.AddItem Cells(i, 1) <<< Next i Application.ScreenUpdating = True Sheets("Enter").Activate End Sub What I still don't understand is why it only has problems in the newer version and works fine in the older!!!! Any ideas???? -Minitman On Mon, 26 Apr 2004 17:40:44 -0500, "Dick Kusleika" wrote: Minitman It looks like you're saying the debugger highlights the Show line. If so, go to Tools - Options - General (in the VBE) and select "Break in Class Modules" in the Error Trapping section. Whenever an error ends on a class instancing line (like Show) it usually means the error is in the class module (the userform module, in this case) but that error trapping isn't set to go there. This will tell you which line is actually causing the error. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Wont Load
Try changing
Cells(i,1) to Cells(i,1).Text Make sure you didn't rename the Listbox. -- Regards, Tom Ogilvy "Minitman" wrote in message ... Hey Dick, Thanks for that advice, that did indeed bring up more information. The VB message box was the same. However, the debugger came up with this: Private Sub UserForm_Initialize() Dim i As Integer Application.ScreenUpdating = False Sheets("CI").Activate lastrow = Range("A65536").End(xlUp).Row For i = 1 To lastrow GetCustInfo_ListBox_01_04.AddItem Cells(i, 1) <<< Next i Application.ScreenUpdating = True Sheets("Enter").Activate End Sub What I still don't understand is why it only has problems in the newer version and works fine in the older!!!! Any ideas???? -Minitman On Mon, 26 Apr 2004 17:40:44 -0500, "Dick Kusleika" wrote: Minitman It looks like you're saying the debugger highlights the Show line. If so, go to Tools - Options - General (in the VBE) and select "Break in Class Modules" in the Error Trapping section. Whenever an error ends on a class instancing line (like Show) it usually means the error is in the class module (the userform module, in this case) but that error trapping isn't set to go there. This will tell you which line is actually causing the error. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Wont Load
Minitman
I don't know why there's a difference between versions. I would guess that the problem here is unqualified references. I think you should re-write the sub as Dim i As Long Dim lastrow As Long With Sheets("CI") lastrow = .Range("A" & .Rows.Count).End(xlUp).Row For i = 1 to lastrow Me.GetCustInfo_ListBox_01_04.AddItem .Cells(i,1).Value Next i End With I'll bet this takes care of the problem. Be sure to note the use of periods in this code, they're important. If it doesn't solve the error, then I would run the program again, get the error, hit debug so that the AddItem line is highlighted, and go to the Immediate Window and type the following ?TypeName(Me.GetCustInfo_ListBox_01_04) ?.Cells(i,1).Parent.Name ?.Cells(i,1).Value and see what you get. -- Dick Kusleika MVP - Excel Excel Blog - Daily Dose of Excel www.dicks-blog.com "Minitman" wrote in message ... Hey Dick, Thanks for that advice, that did indeed bring up more information. The VB message box was the same. However, the debugger came up with this: Private Sub UserForm_Initialize() Dim i As Integer Application.ScreenUpdating = False Sheets("CI").Activate lastrow = Range("A65536").End(xlUp).Row For i = 1 To lastrow GetCustInfo_ListBox_01_04.AddItem Cells(i, 1) <<< Next i Application.ScreenUpdating = True Sheets("Enter").Activate End Sub What I still don't understand is why it only has problems in the newer version and works fine in the older!!!! Any ideas???? -Minitman On Mon, 26 Apr 2004 17:40:44 -0500, "Dick Kusleika" wrote: Minitman It looks like you're saying the debugger highlights the Show line. If so, go to Tools - Options - General (in the VBE) and select "Break in Class Modules" in the Error Trapping section. Whenever an error ends on a class instancing line (like Show) it usually means the error is in the class module (the userform module, in this case) but that error trapping isn't set to go there. This will tell you which line is actually causing the error. |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Wont Load
Hey Dick and Tom, Thanks for replying. It turned out to be a copied row with a #Value! error in it. This was in the column that AddItem was looking to for it's data. It was buried pretty deep, a couple of sheets and a module and several procedures that were all looking at the results of the previous procedure. I had an error that came up very rarely and when it did, it started a chain reaction that did not trace back to the source easily. Once that was fixed everything else seems ok. Thanks for the help. -Minitman On Tue, 27 Apr 2004 07:53:53 -0500, "Dick Kusleika" wrote: Minitman I don't know why there's a difference between versions. I would guess that the problem here is unqualified references. I think you should re-write the sub as Dim i As Long Dim lastrow As Long With Sheets("CI") lastrow = .Range("A" & .Rows.Count).End(xlUp).Row For i = 1 to lastrow Me.GetCustInfo_ListBox_01_04.AddItem .Cells(i,1).Value Next i End With I'll bet this takes care of the problem. Be sure to note the use of periods in this code, they're important. If it doesn't solve the error, then I would run the program again, get the error, hit debug so that the AddItem line is highlighted, and go to the Immediate Window and type the following ?TypeName(Me.GetCustInfo_ListBox_01_04) ?.Cells(i,1).Parent.Name ?.Cells(i,1).Value and see what you get. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Why wont the Excel file load when I double click on it? | Excel Discussion (Misc queries) | |||
Workbook wont load from shortcut | Excel Discussion (Misc queries) | |||
*.csv file wont load correctly | Excel Discussion (Misc queries) | |||
Label Caption Just Wont Work on UserForm | Excel Programming | |||
Load a Userform | Excel Programming |