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 2005

Tip: Looking for answers? Try searching our database.

Passing object as parameter

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
augustus - 10 Oct 2005 12:12 GMT
Hi,

in excel, i can pass object as parameter by simply:

Dim objCbx As ComboBox
Set objCbx = Sheet3.cbxMainData
Call Module1.Test(objCbx)

but in word, I can't
Dim objCbx As ComboBox
Set objCbx = ThisDocument.cbxMainData
Call Module1.Test(objCbx)

the objCbx under word will be empty.

Please tell me how to pass object in word.

Thanks.
Tony Jollans - 10 Oct 2005 12:15 GMT
I can do it in Word so what error do you get?

--
Enjoy,
Tony

> Hi,
>
[quoted text clipped - 14 lines]
>
> Thanks.
Jezebel - 10 Oct 2005 13:10 GMT
Word VBA is syntactically identical to Excel's ... so the problem lies
elsewhere in your code.

> Hi,
>
[quoted text clipped - 14 lines]
>
> Thanks.
augustus - 10 Oct 2005 23:00 GMT
Thanks Tony & Jezebel.

That's what I thought too. (Excel & Word syntact are the same)

THe following is my code:

Private Sub Document_Open()
   Dim strSQL As String, strColumnLocation As String
   Dim objCbx As ComboBox
   
   strSQL = "SELECT * FROM [JobNo_JobName$]"
   Set objCbx = Me.cbxJob
   Call Module1.LoadDatabase(Me.cbxJob, "JobNo", strSQL)
End Sub

But when I run the code under debug mode (ie, F8 button), or query objCBx
inside Immediate mode, I get nothing. WHy?

I have also checked the Tools/Reference, anad ensure that it is identical to
Excel (of course replaced Excel Object with Word Object), but this didn't
help.

> Word VBA is syntactically identical to Excel's ... so the problem lies
> elsewhere in your code.
[quoted text clipped - 17 lines]
> >
> > Thanks.
 
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.