+ Reply to Thread
Results 1 to 16 of 16

Inserting File name inside the Text files

  1. #1
    Forum Contributor
    Join Date
    12-20-2012
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007 & Excel 2010
    Posts
    115

    Inserting File name inside the Text files

    Hello,

    Could someone provide me a VBA for updating the name of the file in Text files.

    I have multiple Text files in a location; I need a VBA which can automatically update file name to these Text files.

    I have attached the simple formats which i needed.

    Before.txt - Original File.

    After.txt - After updating the File name.

    Thanks in Advance.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    12-20-2012
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007 & Excel 2010
    Posts
    115

    Updating the File name

    Hi,

    I need a help with below code;

    I found a code which is able to open the Text files in excel and also updating the FILE NAME in "A" but i have a multiple Text Files in a location and this code getting error once it exceeds the sheet range.

    I need to have this to be continued in the next sheet as soon as one sheet is filled.

    Kindly help me.

    HTML Code: 

  3. #3
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Updating the File name

    Try:
    Please Login or Register  to view this content.
    It (as the original code did) assumes that no single textfile is too big to fit in one sheet.

  4. #4
    Forum Contributor
    Join Date
    12-20-2012
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007 & Excel 2010
    Posts
    115

    Re: Updating the File name

    hello kaper,

    i am getting error after appending the above code.

    This is not continued in the next sheet.

    Please help me.

  5. #5
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Inserting File name inside the Text files

    Those file names look the same to me. However, you can use code similar to this I think:

    Please Login or Register  to view this content.

  6. #6
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Updating the File name

    are you getting the error message or it simply does not do what expected (is new sheet created? where it stops?)

    may be add one more line just for tracing - and check the output in "immediate window" (once you run the procedure).

    I also made one more step with refering explicite to workbook with macro

    So the whole code:
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    12-20-2012
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007 & Excel 2010
    Posts
    115

    Re: Updating the File name

    Hi Kaper,

    Still i am getting error with your new code.

    This code is able to create a new sheet initially and when it going to exceed the sheet range it is unable to create ta new sheet to continue the next files.

    For your reference i have attached the error message.

    Kindly look into this and provide the code..

    Thanks in advance.
    Attached Images Attached Images

  8. #8
    Forum Contributor
    Join Date
    12-20-2012
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007 & Excel 2010
    Posts
    115

    Re: Inserting File name inside the Text files

    Hello

    I have multiple Textfiles in a location and this need to be added inside the Text files.

    Kindly provide the code for making this to be happen

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Inserting File name inside the Text files

    mvinay,

    As per forum rule 5, do not create duplicate threads. I have merged both into one for you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  10. #10
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Inserting File name inside the Text files

    Sorry, I misunderstood, try this:
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    12-20-2012
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007 & Excel 2010
    Posts
    115

    Re: Inserting File name inside the Text files

    Hello

    Your code updates only 0001 as file name.

    I have more than 100 Text files in a location which need to update the filename.

    So could please provide the code which can run and update the File name for Multiple Text files.

  12. #12
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Inserting File name inside the Text files

    Please Login or Register  to view this content.
    You mean like that? not sure I understand...

  13. #13
    Forum Contributor
    Join Date
    12-20-2012
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007 & Excel 2010
    Posts
    115

    Re: Inserting File name inside the Text files

    This is not working.

    I have attached one more file for your reference and i need file name to be added in the text file.
    Attached Files Attached Files

  14. #14
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Inserting File name inside the Text files

    As for Updating ...


    the whole code again (see line with 3 thisworkbook references ):
    Please Login or Register  to view this content.

  15. #15
    Valued Forum Contributor
    Join Date
    11-15-2008
    Location
    ph
    MS-Off Ver
    2007/2010/2016
    Posts
    479

    Re: Inserting File name inside the Text files

    Hi -

    See if this is you're looking for;
    Please Login or Register  to view this content.
    event
    Last edited by event21; 01-28-2014 at 08:22 AM.

  16. #16
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Inserting File name inside the Text files

    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)

Similar Threads

  1. Embedding Picture Files as Pop ups inside Excel Files
    By cmf0106 in forum Excel General
    Replies: 13
    Last Post: 06-08-2021, 11:53 PM
  2. [SOLVED] How to Copy cell value of all files which inside of folder and append to Master file
    By snsuvarna in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-06-2013, 03:38 PM
  3. Follow huge PDF files name, auto inserting the file names in one worksheet
    By cherrychan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-08-2013, 11:00 PM
  4. [SOLVED] how to create multiple text files with different variables inside
    By girishbjp in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-09-2013, 11:46 PM
  5. Renaming files from a number string inside the file.
    By Gordon in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-24-2006, 01:10 PM

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