+ Reply to Thread
Results 1 to 5 of 5

VBA Macro text import memory error

  1. #1
    Registered User
    Join Date
    01-04-2015
    Location
    dk
    MS-Off Ver
    2010
    Posts
    8

    VBA Macro text import memory error

    I´m not an expert on creating macros, but with help found here i managed to create a button that imports a text file to a specific sheet Works perfectly in my testruns on Office 2010, but in office 2013 i get the dreaded "Out of memory"
    This is my coding..Debugger tells me the problem is the last line (.Refresh BackgroundQuery:=False)
    I suspect it´s because excel opens the file, but doesn´t drop the connection after the text import.

    Please Login or Register  to view this content.
    In a perfect world, the user should only press the button ONCE, but sometimes they forget that, and presses it more than once, thus opening a new connection each time.

  2. #2
    Registered User
    Join Date
    06-12-2015
    Location
    Maryland, USA
    MS-Off Ver
    2010
    Posts
    83

    Re: VBA Macro text import memory error

    for TXT files you don't need to use the query function. Excel is capable of opening TXT as straight spreadsheets

    use this (much less memory):

    Please Login or Register  to view this content.
    Last edited by JoeFoot; 06-24-2015 at 05:05 PM.
    Got help? Pls give rep.
    If you do R&D learn VBA

  3. #3
    Registered User
    Join Date
    01-04-2015
    Location
    dk
    MS-Off Ver
    2010
    Posts
    8

    Re: VBA Macro text import memory error

    Thanks, but am I doing something wrong? when I run it (push the button) It quickly opens a new worksheet/workbook, and then closes it again. I can see that it gets the data alright, but they´re not doing me any good if it closes the sheet again

  4. #4
    Registered User
    Join Date
    06-12-2015
    Location
    Maryland, USA
    MS-Off Ver
    2010
    Posts
    83

    Re: VBA Macro text import memory error

    do you want the Test.txt file to remain open?

    If so use this code:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-04-2015
    Location
    dk
    MS-Off Ver
    2010
    Posts
    8

    Re: VBA Macro text import memory error

    Sweet -Now i just need it to open in the already active workbook instead of a new. Button on ark1, data imported to ark2
    Attached the excel sheet, and the textfile i need to import.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] MACRO runs very slowly, getting Run out of Memory error
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-23-2014, 09:55 AM
  2. [SOLVED] Macro with Solver. An unexpected internal error occurred, or available memory
    By sofiaventura in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-26-2013, 04:24 PM
  3. runtime error “out of memory”+excel macro
    By bhavin12300 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-11-2010, 02:25 AM
  4. Macro Error...OUT OF MEMORY
    By G118 in forum Excel General
    Replies: 1
    Last Post: 10-15-2005, 05:05 PM
  5. Error 7 Out of Memory 2/3 through Macro
    By CoderB in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-06-2005, 01:06 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1