Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Sep 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Small change breaks macro (Word 6)

    I still make a lot of use of Word 6, for one thing I can drive its macro language - I never had the time to get into VB. I have one macro that writes bills for me. It puts up a dialog with a dozen or more fields, takes the data out of the dialog and puts it in a letter, works out the tax, and so on. One of the fields I have to include can take on any one of 20-odd non-intuitive strings (imposed by SAP) so instead of typing it in every time I would like to make it a drop-down box.

    I changed very little:
    I declared a new array for the strings and set them up.
    I changed the "TextBox" for the item to a "DropDownBox" and inserted the name of the array. I left the same identifier name the textbox used.
    The dialog box comes up OK, the data is displayed and I can select an entry.
    But the line that sets up the default value for the field now gets a type mismatch error (13). If I REM that out, I get a type mismatch error on the line that takes the selected entry out of the dialog and puts it in the letter.

    But I haven't changed any types anywhere!

    I posted the code on Compuserve's Office forum but nobody could explain the error.
    I have a vague recollection that this is the error that comes up when the Word 6 macro interpreter runs out of space for its list of variables. Could anybody confirm this or explain it some other way? I tried converting the macro to Word 7, but it didn't make any difference - same error, same place.

    I am attaching a cut-down version of the Word 6 macro, which still gets the error (billmac.txt)

    Thanks for any suggestions

    Rosie
    Attached Files Attached Files

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Small change breaks macro (Word 6)

    You likely are having difficulty getting a response because the number of folkes still using Word 6/Word 7 has rapidly diminished.

  3. #3
    New Lounger
    Join Date
    Apr 2002
    Location
    Birmingham, England
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Small change breaks macro (Word 6)

    Your problem is simply that the droplistbox doesn't return the *Text* you select, it returns the *Index* of the item selected (ie a number).

    You just need to pump the result form .PSPElement$ into PSP$() to return the text you want.

    Make sense?

    BillBox.PSPElement$ = PSP$(0)
    will become
    BillBox.PSPElement$ = 0

    Insert " PSP-Element : " : Insert BillBox.PSPElement$ : InsertPara
    will become
    Insert " PSP-Element : " : Insert PSP$(BillBox.PSPElement$) : InsertPara

    Hope that helps.

    G

  4. #4
    New Lounger
    Join Date
    Sep 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Small change breaks macro (Word 6)

    That does male sense, thank you so much!

    Rosie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •