Email:      Pass:    Pass?
Close Window   
Subscribe for Email Updates!
Excel tips, help, and more!


Free Excel Forum

Getting Excel To Search Through Notepad Files

Forum Register
Search Excel Forum Posts, Tutorials, Macros, Tips, and More

Does anyone know if it is possible to get excel to search through a specified set of notepad files for a specific value and copy a secion based on that.

The data pulled from the excel spreadsheet will have a date and data sequence, the date will correspond to a set of notepad files, 1 to 3 files in a folder containing hundreds of notepad files. Is there a way to get excel to look into those notepad files for the corresponding file that is needed, then within that file search for a dataset, and copy a data range around that data set?


Similar Excel Video Tutorials

Helpful Excel Macros

Combine Multiple Workbooks into One
- This macro for Microsoft Excel allows you to combine multiple workbooks and worksheets into one new workbook and workshe
Sort Worksheet Tabs - Ascending or Descending Order
- This macro will sort all of the worksheets in the current workbook. It can sort in ascending or descending order. This
Print Preview Screen Display for The Entire Workbook in Excel
- This free Excel macro allows you to quickly and easily display the print preview window or mode for the entire Excel wor
Filter Data to Display the Results that Begin With Specified Text or Words in Excel - AutoFilter
- This Excel macro automatically filters a set of data based on the words or text that are contained in the beginning of t
Vlookup Function That Searches The Entire Workbook - UDF
- This UDF is a Vlookup function that searches the entire workbook in Excel. The syntax and usage of the function is exac

Similar Topics

Hi guys, please could you help save me some time.

This is basically what i have:

250 folders (i folder per customer), each with 27 (months of info) notepad files, I need to write a macro which can open each notepad file for each customer then copy and paste the data into a different worksheet in a spreadsheet.

Does anyone have any ideas?

Cheers guys


Hi guys, please could you help save me some time.

This is basically what i have:

250 folders (I folder per customer), each with 27 (months of info) notepad files, I need to write a macro which can open each notepad file for each customer then copy and paste the data into a different worksheet in a spreadsheet.

Does anyone have any ideas?

Cheers guys


Is there any way that i program excel to read data from notepad files every time
i open the particular excel file? For example lets say i have created an excel file with 3 worksheets in it. And i also have 3 notepad files with data. Is it possible for excel to link notepad1 with worrksheet 1 and notepad2 with worksheet2 and so on? And ofcourse to read the notepad files every time i open the excel file because the data might have changed.

Thank you for your time.

Within VBA, is it possible to open really large text files to search for data?

These files are often too large for Notepad, and require other text editing programs (like Notepad++).

I have a rather simple test (procedurally), but I can't seem to write the correct macro. I have a spreadsheet which outputs XML code based on a value I enter in a given cell (then auto-populating the changing lines in the XML code).

The final step that I want to accomplish is to simply Copy the XML code from excel, open notepad, paste the XML Code and then save it as a .xml

I really use Dreamweaver to open and edit the XML files, but of course saving it as an XML in notepad is just the same. I have the macro written that opens the files in a specific folder, populates the cell that directs the XML code changes...the only part I am missing is the Copy/Paste and Save As XML.

Any ideas?!

I have csv-files that look as follows when opened with notepad:

If I open them with excel and close them, afterwords in notepad they look like:

Because of this change, the file can't no longer be imported in a certain specific software.

I would like to edit these files without excel making those changes.

I have a workbook with a bunch of live data feeds. 2 columns need to be exported to notepad as .zr0 & .zr1 files. Is there a way to copy the selected range, open & paste into notepad, then save the notepad file with a filename based on a cell reference?

I'm sure this is a fairly complicated process but I haven't had any luck in researching the topic because it seems as though the related posts on here are for people who want all kinds of wacky stuff done (ie. not saving, strictly to print, creating a shell and destroying the file... not my intention)

Just looking for some guidance on a simple macro to copy a range, paste it into notepad, save file with name based on a cell in the same column (will overwrite each time the macro is run).

Any help would be most appreciated.

Thanks in advance,


OK, I have 100 odd excel files (will eventually have 113) all of which containing just one sheet-all named 'sheet 1' in their respective files. What I would like to do is combine these files into one mother-of-all excel files!
* Firstly, is this possible?
* If so, what would be the best way to do so? There is only A:H columns of data, amount of row data varies for each file.

Secondly, is there a way to auto-name the tabs?

Finally, (this is not an excel question but I'll ask anyway) in windows explorer, is there a way to get a list either in word or notepad or whatever of all the files in a specific folder? The 100 odd excel fines are in one folder and I woul like a list of their file names, if possible.


I'm trying to populate multiple Excel fields with data from multiple notepad files. The code below does not put the data from the notepad file "test.txt" into cell B3.
Is what I'm trying to do possible?

Please Login or Register  to view this content.

Hi All,

There is data being automatically stored in text file of the same name, within unique zip files, on a directory.

So I am trying to write a macro that will do essentially two things

1. Look into a directory, and find any new zip file, look into it and open a notepad document called data.txt.

2. Open the notepad file and convert it to tabular form.

the second I can do, but I'm not aware of the first. Can anyone help please?

I have a lot of data in a notepad file. This data contains information I
need to create a database. I want to put it in a Excel worksheet b/f I
transfer it into Access. The notepad file contains various information
packed up together, but seperated by comma's. All the information is in the
same order on the notepad file (For ex. MLS #, Address, City, St., Zip Code,
etc...). I was wondering if Excel 2003 canl search through the file, and
filter the different types of data I need from the ones I don't. Then insert
the data in a spreadsheet which will organize it according to its particular


What is the code to oepn notepad files?
Get error if uses code below:

    Dim noteApp As Object
    Set noteApp = CreateObject("notepad.Application")

Hi I have an interesting problem (I think at least). I have two macros. The first one gets a file name and worksheet name. Then it calls the second macro which opens up notepad (with the specified file name) and pastes the information in excel. The problem that occurs is when I call the second macro more then once in a row from the first macro. It runs great the first time but then problems occur as it tries to run the macro again. (Some times it just closes my excel file with prompting me to save). Calling any of the files works on an individual basis (I've tried for all three). I've erased some of the code due to privacy issues but path location is identical for all three files. Here is the code.


Sub Update()

Call Notepad("survey_fistp_en", "FISTP Data")
Call Notepad("mco_csrm_en", "MCO Data")
Call Notepad("survey_manager_en", "Manager Data")

End Sub

Sub Notepad(Name_of_File, Name_of_Worksheet)

RetVal = Shell("C:\WINDOWS\notepad.exe \\[Path location]" & Name_of_File & ".Asc ", 1)
SendKeys "^a", 10000
SendKeys "^c", 10000
SendKeys "%{F4}{TAB}~"
Workbooks("TLC Comment Reports").Worksheets(Name_of_Worksheet).Range("A5").PasteSpecial Paste:=xlPasteAll

End Sub

Is it possible to attach files?

I need to export specific cells from a row in a specific format into a notepad file and then save it as nameoffile.uai

Each row is a different entry in the notepad file.

All details are attached, with a further explanation.

The format.uai file gives an example of the format in which the export is to be made in.

Im very unfamiliar with VB so all i can really do is copy and paste code.

Any help at all would be appreciated.



Any body please help me

I would like to export the search files name list in to excel or notepad or any format. I want the search name list of the file

For example

If i am searching d:/ drive

i need to export the search files details

Any please help me on this

i have a notepad that have data that i would like to use in excel.
I have read that you can open a notepad in excel with vba and that you can copy contents of the notepad into a string/range. is that possible?

I want to create a macro that will help me open a target file (open as notepad), maybe copy contents to a string.
Because what I really want to do is search through the contents of the text file, and copy a certain string.

the text file contains such dataexample)

MIDlet-Name: Helloword
MIDlet-Version: 1.1.0
MIDlet-Vendor: MyHouse

I want to be able to get the value for "version" or 1.1.0 and copy it to a cell.

Any inputs will be really appreciated. thanks!

is it possible to create a macro to run on an excel sheet that will open a notepad file and do a loop.... example copy lines 1 thru 10 on notepad... go to excel file A1 and paste.... go to notepad lines 11 thru 20 and copy .... go to excel B1 and paste.

basically create some sort of copy loop where you can set it to copy blocks of 10 from notepad and paste in excel sheet where each block of 10 from notepad file goes in the cells a1:A10, B1:B10, C1:C10.... ETC until it ends on notepad (ex... notepad file has 50 lines so set the copy paste loop to end when it reaches 51)

Hi all,

Another query regarding searching of files. This topic in VBA is not easy, at least to my standards.

This time, I want to search a folder which contains hundreds of data files. I want to search for those files based on the Last modified date/time. I want to search those files and copy them to a different destination and open them to copy a particular range of cells to another new work sheet for processing.

For example: I want to search for those files that were last saved in a particular month/week.

The code i need is to search and copy files at destination folder based on date range that I specify and open them. I hope that I can manage with the rest of the code.
I would like to input the date range at a particular cell in my worksheet which the code can access to perform the search.

Thanks in advance.


I'm using the following code to copy columns of data in a worksheet of mine. The code once activated will open "notepad" and copy the columns of data in my excel worksheet. Here is the code: Code:

Sub notepad()
    'The  range that contains the values
    'Start Notepad And let it recieve focus
    Shell "notepad.exe", vbNormalFocus
    'Send the keys CTRL+V To Notepad (i.e the window that has focus)
    SendKeys "^V"
End Sub

Could anyone help me (if it is possible) to edit this code so that after the data is copied in notepad that the notepad document will be saved automatically as "Analysis.txt" and then placed on the C drive closing notepad and leaving my excel spreasheet still visible? Any suggestions and or assistance would be greatly appreciated. I'm trying to simplify some time consuming elements with this code. Thanks in advance!

Hello Excel Team,

I would appreciate if someone can help me with an excel vba code to accomplish the following task.

My Scenario Background:
1) On my desktop I have a folder named "Backlog Reports"
2) This "Backlog Reports" folder contains 5 different text files namely, (i) ABC_1.txt, (ii) ABC_2.txt, (iii) ABC_3.txt, (iv) ABC_4.txt, (v) ABC_5.txt
3) I, already, have 5 different macros specific tailored for each text file namely, (1) ABCMacro_1, (ii) ABCMacro_2, (iii) ABCMacro_3, (iv) ABCMacro_4, (v) ABCMacro_5
4) I have saved all these 5 Macros on a Notepad. The name of this notepad document is "Macros". I have saved this notepad file "Macros" within the folder "Backlog Reports" along with the above 5 text files.

I am looking for a Macro/VBA code to accomplish the following Task
1) When I clik on ABC_1.txt file
2) The macro automatically open up ABC_1.txt file
3) Then Trigger/Invoke the macro ABCMAcro_1 which is specifically related to ABC_1.txt file
4) Once ABCMAcro_1 is run, save the file in Excel format
5) Automatically go to the next text file i.e. ABC_2.txt file
6) Repeat the same process
7) Continue to repeat the exact same process for the rest of the txt files in the "Backlog Folder"

You may wonder why I save macros on a notepad. The reason is I don't know where else I can save them if I want to invoke each macro independently. So, please advise me if you think any other way.

Your help will be a great help. Thanks.

In my spreadsheet, a series of macros calls an external program/application three times. Each time the program finishes, it (and not Excel, as I formerly thought) opens a resource (*.res) file in Notepad, which of course goes into the taskbar. Since I need to run the spreadsheet seven or eight times in a row, the taskbar can get cluttered quickly.

The program opens three different instances of the same filename: iroutine.res.

Is there a way to get Excel to close these Notepad files (if it's simpler to do, it can kill all instances of Notepad) when it finishes running its routines? Thanks.


I am triyng to paste a range in a notepad and then save this notepad as an xml file

So far I have:


Sub test()
    'The  range that contains the values
    'Start Notepad And let it receive focus
    Shell "notepad.exe", vbNormalFocus
    'Send the keys CTRL+V To Notepad (i.e the window that has focus)
    SendKeys "^V"
End Sub

How can I now save this notepad as an XML file (for example: test.xml)


Hi guys,

I have two questions as follows,

1.) I have used a "sum" function to sum few coloumns. For few of the coloumns the sum function result is "0". However, some of the zeroes are showing as negatives i.e. (0.00) and some of the them are showing as positives i.e. 0.00. I tried to figure it out but was not able to. Although, not a big deal. But I thought it is still good to know why?
Does anyone has the answer.?

2.) Recently, I am encountering a problem with my notepad format is changed to Excel. Whenever, I open my notepad it opens in Exce format rather than "text" format. Therefore, everytime I have to open my notepad I have to right clik and choose the option "open with...notepad".
This is a recent phenomena. Prior to this whenever I used to open my notepad it always open in text format. I do not know what caused it.

Similary, I used to save data files from an external program and used to save it as "txt" format. I, then, used to right clik and open these files by choosing Excel format. This way I used to see all the data comes in one coloumn. However, something has changed here as well. So, whenever I open the "txt" file by choosing Excel option it automatically breaks the data into different coloumns. I don't know how it happened.
Does anybody know what happens here and how can I change back to my default setting where my data should remain intact in one coloum. I do not want to have my data automatically broken down into coloumns without having me to decide where to break it.

Any help will be appreciated.



I'm trying to write a macro that does the following:

1. Copy a range of cells from excel
2. Open Notepad
3. Paste, Select All and Copy
4. Return to excel worksheet and paste
5. Close Notepad

Could anyone advise me how you go about coding for closing Notepad please ?!?!?! I dont need to save .txt file once I've pasted back into excel.

Many thanks,

My current macro, copies range of rows from a sheet, and puts it into Notepad.

Please Login or Register  to view this content.

I seek help to save the notepad file to a specific location on Drive, say C:\ABC\Note1.txt

Each time, the notepad file would be overwritten.

Thanks in Advance.