• TextToColumns (XP)

    Author
    Topic
    #430858

    I get a run time error 1004 (Method

    Viewing 0 reply threads
    Author
    Replies
    • #1007114

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

      • #1007117

        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.

        • #1007120

          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.

          • #1007123

            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.

            • #1007125

              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.

            • #1007227

              Thank you Hans for your time, help and explanation!

    Viewing 0 reply threads
    Reply To: TextToColumns (XP)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: