Permalink
Cannot retrieve contributors at this time
title | keywords | f1_keywords | ms.prod | ms.assetid | ms.date | ms.localizationpriority |
---|---|---|---|---|---|---|
Can’t load or unload this object (Error 361) |
vblr6.chm1117809 |
vblr6.chm1117809 |
office |
78438f88-b013-a3d1-9a57-f3a1781691f5 |
06/08/2017 |
medium |
A Load statement or Unload statement has referenced an invalid object or control. This error has the following causes and solutions:
-
You tried to load or unload an object that isn’t a loadable object, such as Screen, Printer, or Clipboard. Delete the erroneous statement from your code.
-
You tried to load or unload an existing control that isn’t part of a control array. For example, assuming that a TextBox with the Name property Text1 exists,
Load Text1
will cause this error.Delete the erroneous statement from your code or change the reference to a control in a control array.
-
You tried to unload a Menu control in the Click event of its parent menu. Unload the Menu control with some other procedure.
-
You tried to unload the last visible menu item of a Menu control. Check the setting of the Visible property for the other menu items in the control array before trying to unload a menu item, or delete the erroneous statement from your code.
[!includeSupport and feedback]
This is my code for listing two text boxes and to select data from one to another. Previously it was working fine. Now it keep on showing "Could not load or unload this object"
I tried removing option explicit
, I deleted a module which was opening this form. Nothing is working. I a added a button click command and then it showed this error. On button click, I just tried to hide this form and show another form. But after that on wards this error is shown. I removed that lines of code and tried. Still it is not working
My code :
Private Sub BTN_moveAllLeft_Click()
Dim iCtr As Long
For iCtr = 0 To Me.ListBox2.ListCount - 1
Me.ListBox1.AddItem Me.ListBox2.List(iCtr)
Next iCtr
Me.ListBox2.Clear
End Sub
Private Sub BTN_moveAllRight_Click()
Dim iCtr As Long
For iCtr = 0 To Me.ListBox1.ListCount - 1
Me.ListBox2.AddItem Me.ListBox1.List(iCtr)
Next iCtr
Me.ListBox1.Clear
End Sub
Private Sub BTN_MoveSelectedLeft_Click()
Dim iCtr As Long
For iCtr = 0 To Me.ListBox2.ListCount - 1
If Me.ListBox2.Selected(iCtr) = True Then
Me.ListBox1.AddItem Me.ListBox2.List(iCtr)
End If
Next iCtr
For iCtr = Me.ListBox2.ListCount - 1 To 0 Step -1
If Me.ListBox2.Selected(iCtr) = True Then
Me.ListBox2.RemoveItem iCtr
End If
Next iCtr
End Sub
Private Sub BTN_MoveSelectedRight_Click()
Dim iCtr As Long
For iCtr = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(iCtr) = True Then
Me.ListBox2.AddItem Me.ListBox1.List(iCtr)
End If
Next iCtr
For iCtr = Me.ListBox1.ListCount - 1 To 0 Step -1
If Me.ListBox1.Selected(iCtr) = True Then
Me.ListBox1.RemoveItem iCtr
End If
Next iCtr
End Sub
'Private Sub cancel_Click()
'Unload.Me
'End Sub
'Private Sub cmdOK_Click()
'frmListBoxTest.Hide
' UserForm2.Show
'End Sub
Private Sub UserForm_Initialize()
Dim iCtr As Long
With Me.ListBox1
.AddItem "1"
.AddItem "B"
.AddItem "D"
.AddItem "G"
.AddItem "A"
.AddItem "BS"
.AddItem "MR"
.AddItem "Ig"
.AddItem "Eng"
.AddItem "BE"
.AddItem "CS"
.AddItem "PS"
.AddItem "C"
.AddItem "TN"
.AddItem "HC"
.AddItem "Cy"
.AddItem "P"
.AddItem "Dr"
.AddItem "ER"
End With
Me.ListBox1.MultiSelect = fmMultiSelectMulti
Me.ListBox2.MultiSelect = fmMultiSelectMulti
End Sub
Previously there was a module named module 1
which had the code to show this userform.
And Option Explicit
was also there in this form code. I removed that.
Images of errors :
asked Mar 19, 2018 at 6:23
5
It used to work, now it doesn’t. Most likely reason, if you haven’t changed anything, is that the compiled code is corrupt.
Step 1: export all modules and forms from the vb editor.
Step 2: save the file as an xlsx (thus removing all vb code)
step 3: Open the xlsx and import all the modules and forms
Step 4: recompile the code (debug,compile)
step 5: save as xlsm
answered Mar 19, 2018 at 13:45
Harassed DadHarassed Dad
4,6491 gold badge10 silver badges12 bronze badges
This repository has been archived by the owner on Aug 31, 2018. It is now read-only.
Permalink
Cannot retrieve contributors at this time
title | keywords | f1_keywords | ms.prod | ms.assetid | ms.date |
---|---|---|---|---|---|
Can’t load or unload this object (Error 361) |
vblr6.chm1117809 |
vblr6.chm1117809 |
office |
78438f88-b013-a3d1-9a57-f3a1781691f5 |
06/08/2017 |
A Load statement or Unload statement has referenced an invalid object or control. This error has the following causes and solutions:
-
You tried to load or unload an object that isn’t a loadable object, such as Screen, Printer, or Clipboard. Delete the erroneous statement from your code.
-
You tried to load or unload an existing control that isn’t part of a control array. For example, assuming that a TextBox with the Name property Text1 exists,
Load Text1
will cause this error.Delete the erroneous statement from your code or change the reference to a control in a control array.
-
You tried to unload a Menu control in the Click event of its parent menu. Unload the Menu control with some otherprocedure.
-
You tried to unload the last visible menu item of a Menu control. Check the setting of the Visible property for the other menu items in the control array before trying to unload a menu item, or delete the erroneous statement from your code.
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS
Contact US
Thanks. We have received your request and will respond promptly.
Log In
Come Join Us!
Are you a
Computer / IT professional?
Join Tek-Tips Forums!
- Talk With Other Members
- Be Notified Of Responses
To Your Posts - Keyword Search
- One-Click Access To Your
Favorite Forums - Automated Signatures
On Your Posts - Best Of All, It’s Free!
*Tek-Tips’s functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.
Posting Guidelines
Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Students Click Here
«Unload Me» question «Runtime error 361 Can’t load/unload this ob«Unload Me» question «Runtime error 361 Can’t load/unload this ob(OP) 19 Aug 04 14:54 Hi again, CODEDim strAddItem As String Red Flag SubmittedThank you for helping keep Tek-Tips Forums free from inappropriate posts. |
Join Tek-Tips® Today!
Join your peers on the Internet’s largest technical computer professional community.
It’s easy to join and it’s free.
Here’s Why Members Love Tek-Tips Forums:
- Talk To Other Members
- Notification Of Responses To Questions
- Favorite Forums One Click Access
- Keyword Search Of All Posts, And More…
Register now while it’s still free!
Already a member? Close this window and log in.
Join Us Close
|
|