+ Reply to Thread
Results 1 to 3 of 3

Automated Import of .csv File into Excel Using Variable as Connection Path?

  1. #1
    Registered User
    Join Date
    04-05-2008
    Posts
    4

    Automated Import of .csv File into Excel Using Variable as Connection Path?

    Hello. I'm working with an Excel sheet that has buttons on it to do the following:

    1. Import a .csv file not created with Excel
    2. Format the .csv file for use with an Access database
    3. Save the formatted file as .xls
    4. Close the formatted file

    My problem is that when I create a macro to do all this for me the connection string to the .csv file is set in the code and doesn't work when I try to use a variable. I would like fo rth connection string to change depending on the user that runs the macro. The original code after macro creation is:

    Please Login or Register  to view this content.
    What I would like to do is something like this:

    Please Login or Register  to view this content.
    Any ideas how to do this? I've tried just opening the .csv file and formatting using Excel but the "Import External Data" function works best for me. Thanks in advance for any inputs!

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Is there a problem with importing the file directly into Access?

  3. #3
    Registered User
    Join Date
    04-05-2008
    Posts
    4
    Yes. There are several columns in which number and text values exist in different rows and import errors always occur unless the .csv file is imported into Excel first using the "Import External Data" function then formatting the column types during the process.

    But...I was able to figure this one out and it works just as I need without using the variable:

    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