
Adding to Collection Object
Sorry that is Word. I must have access on the brain.
Would that make a difference?. The collection object is not part of the
Word Object Model, but of VBA.
By the way until now my VBA experience has been exclusively withen Access.
thanks,
Kevin
Quote:
> Hi Kevin,
> As you are using Access, you may have more chance of getting an answer for
> this on one of the Access newsgroups. This group deals with VBA in Word.
> --
> Regards
> Jonathan West - Word MVP
> MultiLinker - Automated generation of hyperlinks in Word
> Conversion to PDF & HTML
> http://www.multilinker.com
> Word FAQs at http://www.multilinker.com/wordfaq
> Please post any follow-up in the newsgroup. I do not reply to Word
questions
> by email
> > using A2k on Win98SE
> > I keep getting error 13 with this bit of code. colButtons is a
collection
> > object and looking at it in the Locals Window confirms that
> > *****
> > Private Sub UserForm_Initialize()
> > Dim x As Integer
> > Dim oCntrl As Control, oItem As Object
> > For Each oCntrl In Controls
> > If Left$(oCntrl.Name, 3) = "btn" Then
> > x = x + 1
> > Set oItem = oCntrl.Object
> > colButtons.Add oItem, x '<===== Error 13 Data Type
MisMatch
> > here
> > End If
> > Next
> > ...
> > ****
> > I have also tried this without the oItem object like this
> > For Each oCntrl In Controls
> > If Left$(oCntrl.Name, 3) = "btn" Then
> > x = x + 1
> > colButtons.Add oCntrl, x '<===== Error 13 Data Type
> MisMatch
> > here
> > End If
> > Next
> > ****
> > What am I doing wrong here?
> > Thanks
> > Kevin