+ Reply to Thread
Results 1 to 4 of 4

Run-time error '438': Object doesn't support this property or method

  1. #1
    Registered User
    Join Date
    07-27-2010
    Location
    Auburn, MA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Run-time error '438': Object doesn't support this property or method

    Hello,

    I have attached code for a macro which when the file opens automatically allows you to choose a txt file, this txt file is then deliminated by "|" vertical bar. However when I run this code I have gotten a couple error codes. Run-time error '438' and error '7' out of memory. Any reason these error codes are coming up?

    Thanks in advance!

    Under the ThisWorkbook:

    Please Login or Register  to view this content.
    Under the macro module:

    Please Login or Register  to view this content.
    Last edited by ThaGreenMoose; 11-04-2011 at 11:34 AM.

  2. #2
    Forum Contributor
    Join Date
    05-09-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    315

    Re: Run-time error '438': Object doesn't support this property or method

    Which line causes the error message?

    I'm guessing it'll be Target = myValue

    You declared Target as a range but you're trying to assign a value to it (myValue = Target.Value).

    What are you trying to do with this part of the code:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-27-2010
    Location
    Auburn, MA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Run-time error '438': Object doesn't support this property or method

    Mojo,

    If I am remembering correctly, the part of the code you're referencing was a method I had seen elsewhere to keep the formatting for all cells pasted into a worksheet similar to that of cell A1.

    I had removed that portion of the code. Ran the macro and get the error again on the following part of the code:

    Please Login or Register  to view this content.
    I also removed this part of the code and now the macro seems to be working without issue.

    Now as soon as I launch the worksheet it allows me to select a .TXT file any file path it then in turn takes that .TXT file and deliminates it using vertical bars and pastes that data into cell A1. If you then close and relaunch the worksheet it will allow you to select a new .TXT file after which it will erase all of the old data and replace it with the new set of data which is also deliminated by vertical bar.

    Thanks Mojo!

    The final code now reads:

    Under the ThisWorkbook:

    Please Login or Register  to view this content.
    Under the Module:

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    05-09-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    315

    Re: Run-time error '438': Object doesn't support this property or method

    You're welcome.

    I see what the code is doing now. It prevents the formatting of cells being change - if you copy from one cell to another it will only copy the value of the cell.

    I wonder if there was a conflict between the SheetChange event and your import code (because your import code will trigger the SheetChange event). If you want to retain SheetChange, you could add a condition to switch it off while you're importing the text file by declaring a public variable varCancelSheetChange and assigning a value to it (varCancelSheetChange = "True") at the top of Sub openIt() and changing your SheetChange code as follows:

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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