+ Reply to Thread
Results 1 to 4 of 4

Use an Excel Macro in Access VBA - Import text file in Access Table

  1. #1
    Registered User
    Join Date
    07-29-2010
    Location
    Multan
    MS-Off Ver
    Excel 2010
    Posts
    38

    Exclamation Use an Excel Macro in Access VBA - Import text file in Access Table

    Hi
    i have following code t0 import a text file into excel spread sheet . Can any one help me to modifiy this code this code for use in access with little modification to select the file from dialogue box . text file is attached 41512008.zip

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,852

    Re: Use an Excel Macro in Access VBA - Import text file in Access Table

    In Access there is a VBA function that does this for you. Look at the DoCmd.TransferText function

    Here is a link to understand its functionality.

    http://msdn.microsoft.com/en-us/libr...ffice.14).aspx
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    01-21-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    227

    Re: Use an Excel Macro in Access VBA - Import text file in Access Table

    Quote Originally Posted by alansidman View Post
    In Access there is a VBA function that does this for you. Look at the DoCmd.TransferText function

    Here is a link to understand its functionality.

    http://msdn.microsoft.com/en-us/libr...ffice.14).aspx
    I think he is wanting to update data to Access from Excel, for that he might want to go thru ADODB referencing.
    If I've been of help, plz add reputation.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,852

    Re: Use an Excel Macro in Access VBA - Import text file in Access Table

    There is no need to take the intermediary step. DoCmd.transfertext will import .txt or .csv files directly to a new or existing table. It is clean and quick. As to the formatting of each field, this can be done in Access by setting up Import Specification in the Import Wizard and naming it and saving it. The import Spec can then be used in your VBA DoCmd function.
    Last edited by alansidman; 10-08-2014 at 10:07 AM.

+ 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. Text File Convesion to Access Import
    By JerryCapo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-02-2014, 10:07 AM
  2. Import Text File to Access Table using Excel VBA
    By curiosity1990 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-07-2013, 09:43 AM
  3. Macro to Import Excel Data into an MS Access File
    By SaurabhShri1 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-26-2013, 08:08 AM
  4. Copy Excel to Text file and pass Text file to Access Table
    By robbie_xcell in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-27-2011, 01:53 PM
  5. [SOLVED] [SOLVED] VB Code or Excel macro to run Query/Import on Access file
    By Harry in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 02-22-2005, 04:06 PM

Tags for this Thread

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