Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using User Forms in Word AutoNew macro 1

Status
Not open for further replies.

Natbe

MIS
Apr 4, 2003
4
US
Hello,

VB training doesn't cover writing code in Word macros, so you guys and my own feeble brain are my only hope.

In trying to convert my WordBasic dialog boxes to the VB forms in an AutoNew macro, I get an "object required" error regarding my .List statement for the list box. See below and show me what's missing.

Form is named frmDlg_1; listbox is named lstFaxOrg; Form is attached to the template. Do I need to add Dim statements?

Code:
Open TplPath$ + "\XFAXORG.TXT" For Input As 1

Rem Line #1 is a number, the total number of lines in the text file
Line Input #1, FaxCnt
FaxCnt_ = FaxCnt - 1
ReDim FaxOrgArr__$(FaxCnt_)
ReDim FaxNumArr__$(FaxCnt_)
ReDim FaxExtArr__$(FaxCnt_)
ReDim FaxContactArr__$(FaxCnt_)
For Cnt = 0 To FaxCnt_
    Input #1, FaxOrgArr__$(Cnt), FaxNumArr__$(Cnt), FaxExtArr__$(Cnt),
FaxContactArr__$(Cnt)
Next Cnt
Close 1

Load frmDlg_1
' The next line gets the error "Object required"
lstToOrg.List = FaxOrgArr__$()  
frmDlg_1.Show

Thank you,

Natelle
 
When I say," do I need Dim statements," I mean for the frmDlg_1 form or the lstToOrg listboxes. There are Dim statements for the other variables already. Thx, Natelle
 
Thanks Justin. I had done some reading about Objects, how to reference them, and sort of knew what I needed to do last night, but was thinking something like: Load Forms(frmDlg_1) But your solution did the trick. Thanks!! -Natelle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top