Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2006

Tip: Looking for answers? Try searching our database.

Drop-Down list

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Debra Ann - 24 Apr 2006 18:29 GMT
I have a program that pulls up the cross-references for any existing figures
in a dropdown box.  This program has not problem showing the figures if there
are 1 to 8 figures; however, if there are more than eight figures in the
document, you don't see them listed.  Please let me know why you think this
is happening.  Thanks,

Here is the code:

Private Sub UserForm_Initialize()
   Dim varXRefs As Variant
   Dim Index As Integer
   
   Selection.Fields.Update

   ' Clear out any previous contents

   Me.cboFigureNumber.Clear

   ' Load just the figures into varXRefs

   varXRefs = ActiveDocument.GetCrossReferenceItems _
   (ReferenceType:="Figure")

   ' Load the ListBox from varXRefs as an array

   For Index = 1 To UBound(varXRefs)
       Me.cboFigureNumber.AddItem varXRefs(Index)
   Next Index

   ' Test whether the list has any entries and
   ' set command buttons accordingly

   If Me.cboFigureNumber.ListCount > 0 Then
       Me.cboFigureNumber.ListIndex = 0
       Me.cmdInsert.Enabled = True
   Else
       MsgBox ("There are no figures to cross-reference.")
       ReferenceFigure.Hide

   End If

End Sub

Signature

Debra Ann

zkid - 25 Apr 2006 20:06 GMT
If you msgbox varXRefs, what value does it state?

> I have a program that pulls up the cross-references for any existing figures
> in a dropdown box.  This program has not problem showing the figures if there
[quoted text clipped - 38 lines]
>
> End Sub
Debra Ann - 26 Apr 2006 13:18 GMT
If I try to have msgbox(varXRefs), it comes up with an error.  If I step
through the program and stop, the varXRefs(index) always gives me the correct
count.  Of course, it is hard to test when you don't get the error that
others are getting.  I'll have to check out their file on their system and
see what is going on.  Thanks.
Signature

Debra Ann

> If you msgbox varXRefs, what value does it state?
>
[quoted text clipped - 40 lines]
> >
> > End Sub
zkid - 28 Apr 2006 20:15 GMT
Hi Debra Ann,

I'm sorry, what I meant was msgbox Ubound(varxRefs).  Check to make sure
that it agrees with varxRefs(index).

I'm assuming you are not using Option Base 1 and your array starts with zero?

> If I try to have msgbox(varXRefs), it comes up with an error.  If I step
> through the program and stop, the varXRefs(index) always gives me the correct
[quoted text clipped - 46 lines]
> > >
> > > End Sub

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.