User-defined type error

rjplante

Well-known Member
Joined
Oct 31, 2008
Messages
574
Office Version
  1. 365
Platform
  1. Windows
I have a workbook that I have been using and I am running into an error when I run the macro that executes on close. I get the following error: "User-defined type not defined." My VBA window appears when this error pops up and then when I click on the ok button, it returns me to the excel window of my workbook. When I go to the VBA window again no, code window is displayed and no code line is highlighted which would indicate where I should look to repair my code.

What can I do to remedy this issue?

Thanks

Robert
 
Nothing is listed as being missing. Still at a loss as to how to find what is causing the error to appear. I have checked the break on all errors and still no line of code gets highlighted when the message appears. I am thoroughly confused. I have removed the code below which was implemented to disable the red close box on my user forms. My error started appearing after I made this change. I have the code still there, just with the comment indicator ( ' ) in front of it to disable the code. This has not corrected my problem. I will look for another way to make this change and see if it still remains.

Thanks for all the help. Wish I were smarter. :(


Code:
Private Sub UserForm_QueryClose(Cancel As Integer, _
  CloseMode As Integer)
  If CloseMode = vbFormControlMenu Then
    Cancel = True
    MsgBox "Please select the CANCEL button on the form!"
  End If
End Sub

[\code]
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
You haven't posted all of your code, but I do note that in your userform1 code you have:
Rich (BB code):
Activeworbook.Save
which should be:
Rich (BB code):
Activeworkbook.Save
 
Upvote 0

Forum statistics

Threads
1,225,156
Messages
6,183,236
Members
453,152
Latest member
ChrisMd

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top