+ Reply to Thread
Results 1 to 6 of 6

Export GP record in Excel to individual .txt files

  1. #1
    Registered User
    Join Date
    02-08-2018
    Location
    London
    MS-Off Ver
    2019
    Posts
    40

    Export GP record in Excel to individual .txt files

    Hello All - help please!

    I have long-term health problems, and keep all documents in a folder. I have recently downloaded my GP medical history in a PDF format, and have copied and pasted this into an Excel (2019) workbook.
    Some of the entries just have a date, but some have a date and time, and there are often multiple entries for one day, some with times and some without.
    What I would like is to use this Excel file to create a .txt file for each entry, with the name of the file relating to the date and time of the entry and the person making the entry which shows on the second line. For those without times, they could either not show a time, or show 00:00. In fact, it would be easy enough for me to reformat the ones without times as 'dd/mm/yyyy hh:mm' and they will then show as 00:00.
    I would like the following file name format, including the spaces, WITH 'NAME OF PERSON' being what appears on the second line of each entry:

    YYYY-MM-DD - HH:MM NAME OF PERSON - NHS GP Consultation entry

    I have attached a small example file, though the actual PDF is over 100 pages. (Note all my personal data and that of other individuals has been changed). I've also attached a screen grab of page 1 of the PDF file.

    User 'hungt' helped me with something similar in February, which worked perfectly, but unfortunately doesn't deal with the multiple entries for one day, and also adding the date and the person's name to the filename.

    TIA
    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    05-02-2013
    Location
    Poland
    MS-Off Ver
    Excel 2013
    Posts
    368

    Re: Export GP record in Excel to individual .txt files

    Code in Module1

    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor
    Join Date
    05-02-2013
    Location
    Poland
    MS-Off Ver
    Excel 2013
    Posts
    368

    Re: Export GP record in Excel to individual .txt files

    I suggest changing the filename definition in case of duplicate. The changed parts are in red.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    02-08-2018
    Location
    London
    MS-Off Ver
    2019
    Posts
    40

    Re: Export GP record in Excel to individual .txt files

    Hi Hungt -

    Thanks, but I seem to be getting an error. I pasted your second text into a workbook, but when I run it I get a "Run-time error '6': Overflow" error, and then it highlights the 5th line "data = .Range("A1:A" & lastRow + 1).Value ' we will take an extra row at the end of the table"

    I've attached screenshots.

    Apologies if I am doing something stupid; I'm a total novice at all of this.

    Screenshot2 2025-05-31.jpgScreenshot 1 2025-05-31.jpg

  5. #5
    Valued Forum Contributor
    Join Date
    05-02-2013
    Location
    Poland
    MS-Off Ver
    Excel 2013
    Posts
    368

    Re: Export GP record in Excel to individual .txt files

    I don't have an error. Besides, this line can't cause an error even if there is no data in column A.

    I'm attaching the file.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    02-08-2018
    Location
    London
    MS-Off Ver
    2019
    Posts
    40

    Re: Export GP record in Excel to individual .txt files

    Hi -

    It worked! Sorry, I obviously did something stupid the first time. Then it worked, but only for some of the data, until I discovered that some of the data that I'd copied across had come over as weird symbols and there were errors. Once I corrected all of that it worked perfectly.

    I'm really very grateful for your help, which has been incredibly useful at a difficult time in my life.

    Thanks!

+ 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. Export diary in Excel to individual .txt files once only
    By GarethHamill in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-28-2025, 08:01 AM
  2. VBA Export from excel to access add new record, or update existing record
    By NicoV in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-08-2021, 07:36 AM
  3. Export rows as individual files
    By fogster74 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-31-2017, 11:32 PM
  4. How to export Excel rows into individual txt files (Mac)
    By jane_scott in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-09-2017, 12:33 PM
  5. Export Individual Rows To Individual Text Files?
    By jimmer18 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-13-2014, 11:43 AM
  6. Combine data from 4 workbooks and then export filtered data to individual files?
    By womanket in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-16-2013, 12:20 PM
  7. Replies: 1
    Last Post: 01-31-2012, 09:07 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