+ Reply to Thread
Results 1 to 3 of 3

open multiple file text and insert the data to sql server

  1. #1
    Registered User
    Join Date
    02-10-2016
    Location
    indonesia
    MS-Off Ver
    2010
    Posts
    2

    Post open multiple file text and insert the data to sql server

    Hello, I have a case here,

    I want to open multiple text (TXT) files using vba macros, then smoothed the data first before being transferred to sql server, here's my code to open multiple file, but i still have problem in looping process..

    Sheets("Branch_Process").Select
    For i = 7 To 9
    varCellValue = range("H" & i).Value
    fileName = "C:\Users\SIMAS-FUJ1\Documents\DataTextfile\" & varCellValue

    Workbooks.Open (fileName)
    Next i
    the problem is, it's only open the first file and i got a messagebox "file C:\Users\SIMAS-FUJ1\Documents\DataTextfile\." cant find or maybe delete.

    thankyou..

    FYI : cell value in H7 until H9 is the name of the file txt,, example : ASR_ID0010183_CRF.BLSHEET1.SUMMARY_20151231.txt, etc

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: open multiple file text and insert the data to sql server

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window (or use the paperclip icon).
    Cheers!
    Deep Dave

  3. #3
    Registered User
    Join Date
    02-10-2016
    Location
    indonesia
    MS-Off Ver
    2010
    Posts
    2

    Re: open multiple file text and insert the data to sql server

    Quote Originally Posted by NeedForExcel View Post
    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window (or use the paperclip icon).
    i already attached workbook and 2 sample data txt.
    there is 204 files that need to open and do something to clean the data first, and then export to sql server before return to do same process with another data until 204 files.. for example, looping with 2 data sample. but the problem is that it said the second file is not detected/removed,, when i test without looping, open each file is succeed.

    if someone have the same problem like mine, pls help.. i really appreciate,, thankyou

+ 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. Insert Multiple Coulumn data in SQL Server
    By Sewak1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-18-2014, 05:00 PM
  2. VBA open file, insert data, close file by tab.
    By Aquabat in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-27-2013, 03:37 PM
  3. Open multiple dated text files and import dated data specified in file name
    By andygxxxv in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-21-2013, 03:56 PM
  4. Cannot open file from ftp server
    By caabdul in forum Excel General
    Replies: 1
    Last Post: 12-07-2012, 10:38 AM
  5. [SOLVED] On open, insert text file as module
    By Marco-Kun in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-26-2012, 11:12 AM
  6. Cell content to open another file on server
    By Damianoneill in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-06-2006, 09:41 AM
  7. [SOLVED] How do I import text file, analyze data, export results, open next file
    By Geoffro in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-06-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