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 / October 2006

Tip: Looking for answers? Try searching our database.

Listbox not working on Mac

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JGJP - 13 Oct 2006 15:57 GMT
I have a listbox directly in a word document. It works great on Windows
computers but the Mac freaks out at the DocumentOpen code

Private Sub Document_Open()
  Dim BookFormats, FormatDrop

   BookFormats = Array("Book Format", "Hardcover", "Paperback")

   If FormatDrop = "" Or FormatDrop = "Book Format" Then
       Me.FormatDrop.List() = BookFormats
   Else
       FormatDrop.ListIndex = 0
   End If

End Sub

Can you please tell me what I need to do to make this work on the Mac?

Thanks
Russ - 13 Oct 2006 17:56 GMT
I put your subroutine in one of my Userform's code and created a listbox
called FormatDrop and called it with a click event in my MacWord 2004 and it
seem to work without a hitch. Are you using it in what Word calls a UserForm
object, which is like a homemade popup dialog box and not in a document with
fields, which other people confuse with Userforms? What line gives you an
error message and what is the message?

> I have a listbox directly in a word document. It works great on Windows
> computers but the Mac freaks out at the DocumentOpen code
[quoted text clipped - 15 lines]
>
> Thanks

Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

JGJP - 13 Oct 2006 19:43 GMT
Russ, Thanks for your help. I had hoped to leave it actually in the
document. If you're going to tell me the only way I can do this is with
a userform object, I'll do that, but on the PC, it allows me to put the
list in the document.

The error is on the Me.

Thanks again,

Jeanne

> I put your subroutine in one of my Userform's code and created a listbox
> called FormatDrop and called it with a click event in my MacWord 2004 and it
[quoted text clipped - 22 lines]
> >
> > Thanks
Russ - 14 Oct 2006 18:34 GMT
Jeanne,

> Russ, Thanks for your help. I had hoped to leave it actually in the
> document. If you're going to tell me the only way I can do this is with
> a userform object, I'll do that, but on the PC, it allows me to put the
> list in the document.
>
> The error is on the Me.

I played around with this Sub test() on my MacWord...

Sub test()
MsgBox Me.Name
MsgBox ThisDocument.Name
End Sub

...And I get "invalid use of 'Me'..." when this sub is used in any Project
"Modules" folder code. It does work when used in Project "Forms" folder code
or Project "Microsoft Word Objects" folder code using the ThisDocument
'container?'
And it might work in a Project "Class Modules" folder code, but I don't know
how to set up and call a 'class' to test.

Maybe you are using the code in a different Project folder in MacWord than
WinWord?

> Thanks again,
>
[quoted text clipped - 26 lines]
>>>
>>> Thanks

Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

desksideguru@gmail.com - 18 Oct 2006 05:17 GMT
Thanks so much, Russ. It looks as though I will have to create forms
after all.

I appreciate all of your help.

Jeanne
Russ - 18 Oct 2006 08:11 GMT
Jeanne,
An easier solution might be to do a find and replace, and selectively
replace the 'me' in the document code with 'activedocument' when they are
suppose to refer to the currently active document. But don't replace any
'me' that is used in a userform dialog or a ThisDocument module because it
shouldn't be necessary. I.E.
Me.FormatDrop.List() = BookFormats -->
ActiveDocument.FormatDrop.List() = BookFormats

However, that is exactly what this site is saying below. An Document_Open
subroutine should be placed in the **ThisDocument module** of your
**template** and according to my experimenting on the MacWord, the
"Me.FormatDrop.List() = BookFormats" should also work in that module. That's
why I asked if you were using it in the same module as it was being used in
WinWord?
http://word.mvps.org/faqs/macrosvba/DocumentEvents.htm

> Thanks so much, Russ. It looks as though I will have to create forms
> after all.
[quoted text clipped - 59 lines]
>>>>
>>>> Thanks

Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID


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.