Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Trim Function (Word 2K SP3)

    I'm Befuddled

    Note: When reading the following code, inject a series of spaced before and after the 3 dashes.

    The following code works properly: y = "x" & LTrim(RTrim(" --- ")) & "x"

    yet the following code: y = "x" & Trim(" --- ") & "x"
    results in the following error message:
    "Compile Error:
    Wrong number of arguments or invalid property assignment."

    Does anybody have any insight?

    Thanks in advance
    Regards
    Don

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Trim Function (Word 2K SP3)

    1. Check very carefully if there exists a function or procedure named Trim somewhere in your code. If so, VBA would try to use that instead of the built-in function.

    2. Check carefully that you haven't named a module "Trim".

    3. Select Tools | References... and check if there are MISSING references. If so, clear their check boxes. Otherwise, check if there are unusual or unnecessary references (you'll need at least Visual Basic for Applications, Microsoft Word 9.0 Object Library and Normal.)

  3. #3
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Trim Function (Word 2K SP3)

    Thank you very much Hans

    I had a procedure named Trim in a different module within the same project.

    Once again Woody's Lounge to the rescue
    Regards
    Don

Posting Permissions

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