Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Apr 2001
    Posts
    482
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Passing arguments to a sub (Word 2000)

    This ought to be easy. I've looked at online help and examples in the forum, but just can't get this. I'm trying to set up a sub to receive a string argument, and the call the sub with the argument. However, I keep getting a message "Array or user-defined type required".

    My sub I'm calling looks like this:

    Sub BrowseForFile(BrowseTitle() As String)

    My latest of many attempts for a call for this (coming from a procedure in the same module) is this:

    Call BrowseForFile(BrowseTitle)

    BrowseTitle is a public string variable.

    What am I doing wrong?

    Thanks again!!
    Troy

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Passing arguments to a sub (Word 2000)

    Hi Troy,
    You need to change your sub to:
    Sub BrowseForFile(BrowseTitle As String)
    with the parentheses you've got now, it's expecting a string array argument.
    HTH
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    4 Star Lounger
    Join Date
    Apr 2001
    Posts
    482
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Passing arguments to a sub (Word 2000)

    Thanks!! That did it!!
    Troy

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

    Re: Passing arguments to a sub (Word 2000)

    You must pass a string array, not a string variable.

Posting Permissions

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