Jump to content

Why Does This Code Generate Error 91?


JayRenn

Recommended Posts

There are only two functions in my project: the initialization and an OK button. The initialization part does all the work. The OK button just dismisses the form. When I click the OK button, it executes the two lines you see below, then generates error 91, so I have no idea what object it is talking about. Any ideas?

 

Private Sub btnOk_Click()

Me.Hide

Unload Me

End Sub

 

Private Sub UserForm_Initialize()

Dim ssetObj As AcadSelectionSet

Dim intMode As Integer

Dim grpCode(0) As Integer

Dim dataVal(0) As Variant

Me.Hide

 

Set ssetObj = ThisDrawing.SelectionSets.Add("SS01")

intMode = acSelectionSetAll

 

grpCode(0) = 0

dataVal(0) = "KS_SHAPE"

 

ssetObj.Select intMode, , , grpCode, dataVal

 

If ssetObj.Count > 0 Then

MsgBox "Found them.", vbOKOnly

End If

 

ssetObj.Delete

 

Me.Show

End Sub

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...