+ Reply to Thread
Results 1 to 4 of 4

VBA doesn't work on CSV file, but works on XLS?

  1. #1
    Registered User
    Join Date
    06-20-2017
    Location
    london
    MS-Off Ver
    2010
    Posts
    38

    VBA doesn't work on CSV file, but works on XLS?

    Hi - i have this file which i download everyday in a CSV format. I have written a macro to arrange the data, which requires querying some data from access. However, this doesnt seem to work on the CSV file when i run it.

    I get an error "User-defined type not defined", whenever i try to run this on the csv file. I have the macro stored in personal.xlsb as we

    However, this is resolved when i manually copy and paste the data from the CSV file into the workbook where the macro is initially created - a xlsm file.

    Is there any way to automate and run this macro in my CSV file?

    Please Login or Register  to view this content.

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: VBA doesn't work on CSV file, but works on XLS?

    Hi,

    If the macro is in your personal macro workbook, you need to set a reference to the Microsoft ActiveX Data Objects library in that workbook.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Registered User
    Join Date
    06-20-2017
    Location
    london
    MS-Off Ver
    2010
    Posts
    38
    Quote Originally Posted by xlnitwit View Post
    Hi,

    If the macro is in your personal macro workbook, you need to set a reference to the Microsoft ActiveX Data Objects library in that workbook.
    How do I do that? I am new

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: VBA doesn't work on CSV file, but works on XLS?

    Locate the macro in that workbook, then click Tools- References and find the reference and check it. Make sure to save the workbook when you close Excel.

+ 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] Hide/Unhide macro works then doesn't work.
    By JoeVanGeaux in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 03-19-2017, 01:56 PM
  2. [SOLVED] FileOpen works then doesn't work - Why?
    By delaing in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-09-2016, 06:54 PM
  3. [SOLVED] IF formula in ARRAY = works <> doesn't work
    By bkanealy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-02-2014, 09:31 AM
  4. [SOLVED] formula works in cell but doesn't work in vba
    By maleeny31 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-05-2013, 12:36 AM
  5. [SOLVED] vLookup works, then doesn't work- what's causing the inconsistency?
    By ScotyB in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-16-2012, 09:56 PM
  6. Macro that works on PC doesn't work on Mac.
    By elrader in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-09-2012, 03:52 PM
  7. it works, it doesn work, its works....and so on.
    By Naz in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-30-2005, 09:05 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