Results 1 to 7 of 7
  1. #1
    3 Star Lounger Omega3's Avatar
    Join Date
    Jan 2004
    Location
    Los Angeles, California, USA
    Posts
    343
    Thanks
    2
    Thanked 1 Time in 1 Post

    TextToColumns (XP)

    I get a run time error 1004 (Method
    You know it's time to diet when you push away from the table and the table moves.

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

    Re: TextToColumns (XP)

    In the TextToColumns instructions, you have an unqualified reference to Range("F1") and to Range("A1"), respectively. This causes the problems. Change them to <code>.Range("F1")</code> and <code>.Range("A1")</code>

  3. #3
    3 Star Lounger Omega3's Avatar
    Join Date
    Jan 2004
    Location
    Los Angeles, California, USA
    Posts
    343
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: TextToColumns (XP)

    Oh no that little period again. Thank you Hans for catching that. I made the changes and of course it worked. I'm still puzzled though as to why that little period didn't cause me problems the first time through. Thanks again for your sharp eyes.
    You know it's time to diet when you push away from the table and the table moves.

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

    Re: TextToColumns (XP)

    Unqualified references usually cause this kind of behavior. The first time round, the code works OK, but an invisible instance of the application (Excel in this case) is left in memory, and this throws a spanner in the works the second time the code is run.

  5. #5
    3 Star Lounger Omega3's Avatar
    Join Date
    Jan 2004
    Location
    Los Angeles, California, USA
    Posts
    343
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: TextToColumns (XP)

    Thanks for posting back and that insight. It would certainly explain it.

    So even though I code xlApp.Quit and then Set xlApp = Nothing doesn't really get rid of Excel but just the variable object that's pointing to it. I guess Windows leaves it in memory in case it is needed again to speed things up. Interesting.
    You know it's time to diet when you push away from the table and the table moves.

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

    Re: TextToColumns (XP)

    The problem is that the unqualified reference somehow creates a second instance of Excel - don't ask me how.
    The instructions xlApp.Quit and Set xlApp = Nothing dutifully remove the instance you created explicitly, but not the second instance.

  7. #7
    3 Star Lounger Omega3's Avatar
    Join Date
    Jan 2004
    Location
    Los Angeles, California, USA
    Posts
    343
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: TextToColumns (XP)

    Thank you Hans for your time, help and explanation!
    You know it's time to diet when you push away from the table and the table moves.

Posting Permissions

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