Close Window   
Free Ebook
Got an Excel Question?
Ask it in our Excel forum!
TeachExcel.com
Subscribe for Free Excel tips & more!
E-mail:
Advertisements



Getting Excel To Search Through Notepad Files

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

Hello,
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?

Thanks

View Answers     

Similar Excel Tutorials

How to import Text Files (CSV) into Excel
Text files in CSV format are one of the easiest ways to store and transfer data as it is one of the most compatible ...
Export an Excel File to a CSV File
How to export an Excel file to a CSV file (comma separated values file).  This allows you to turn any Excel spread ...
Delete All Rows that Contain a Specific Value in Excel
Quickly find all rows in Excel that contain a certain value and then delete those rows. This is a simple technique ...
How to Quickly Find Data Anywhere in Excel
Finding specific records and/or cells is easy when using the Find tool in Excel. It is located within the Find & ...

Helpful Excel Macros

Excel Macro to Save a Specific Worksheet as a New File
- This Excel Macro allows you to save a specific worksheet within the Excel Workbook to its own new file. You will be a
Combine Multiple Workbooks into One
- This macro for Microsoft Excel allows you to combine multiple workbooks and worksheets into one new workbook and workshe
Save the Current Worksheet as a New File in the Current Folder
- This Excel Macro saves the currently visible worksheet into the SAME folder as the current file. It is different from
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
Excel Macro that Searches Entire Workbook and Returns All Matches
- This is the ultimate Lookup Macro for Excel. It will search every worksheet in the workbook and return all of the mat

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

Nick


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

Nick




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:
"ABC","DEF","GHI"

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

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,

Rob




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
category



Hi

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

    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.

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?

Hi,
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.

Thankyou!!


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.

Cheers
-Yogesh

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
    Range("A3:H2000").Copy
    '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.

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

So far I have:

Code:

Sub test()
    'The  range that contains the values
    Range("B2:E18").Copy
    '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)

Thanks


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.

ia


Hi,

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,
J




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.

I'm using VBA to select a range in excel, open notepad, paste the range, select all, copy, switch back to excel and paste special as text.

The problem I'm getting is at the last line of the code below, the sendkey used to close notepad. It actually closes the VB Editor, not notepad. I've used APPActivate "Notepad" to bring the focus to notepad but that didn't work either. The previous commands correctly act on notepad.

Any suggestions? In addition, any ideas on how to bring the focus back to the excel wkb used (not always the same wkb) after notepad has closed?

Any help appreciated!

Code:

    
    Range("A:D").Select
    Selection.Copy
    
    'Start Notepad and let it recieve focus
    Shell "notepad.exe", vbMaximizedFocus
    
    'Send keys of actions to notepad
    SendKeys "^v"
        
    SendKeys "^a"
    SendKeys "^c"
    SendKeys "%{F4}{TAB}{ENTER}"


PS. The reason I'm not using only excel, is that all the range is date columns with different formats. I need these columns to keep only the diplayed format and not the numerical value stored behind it in order to be able to use the find function later, but nothing in excel seems to work, hence using notepad.


hi all,
can u tell me a good efficient way to transfer data from a text file(notepad...data is systematically arranged seperated by comma) into a excel sheet using VB6.

i have tried Opentext method... but i need a much better way to increase the effeciency for incase the file may have one lakh rows...something like that.

rajesh


hi all,
can u tell me a good efficient way to transfer data from a text file(notepad...data is systematically arranged seperated by comma) into a excel sheet using VB6.

i have tried Opentext method... but i need a much better way to increase the effeciency for incase the file may have one lakh rows...something like that.

rajesh


Hi guys,
I have some tricky thing to do in excel and it would be great if you could help me. I have to do a macro that will open a .key file with notepad from the adress specified in a cell and copy the 3rd line in this text file in another cell in the same workbook.


This is how it should look like, unfortunately I can't share the .key files. Thanks for the help.




I must create a process that FTPs a CSV file. The table receiving the file has been structured so that it rejects all files with blank rows (this is out of my control). Saving Excel files as .csv retains a blank row I cannot access or delete in any MS Office application. I can only view and delete this blank row in Notepad.

I have altered the proposed process so that:
Saves the file as .csv
Opens the file in Notepad
strikes "CTRL + END" via the sendkeys function to move the cursor to the end of the file
strikes "BACKSPACE" via sendkeys to delete the final row
strikes "CTRL + S" via sendkeys to save the file
strikes "ALT + F4" via sendkeys to close Notepad

The process then resumes as normal to FTP the file.

I have two questions.

Can you think of any reason why this method is unreliable or volatile?

Is there a better way to delete that final hidden row?

Thanks