Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Sending text to notepad

Posted on 2003-11-18
9
678 Views
Last Modified: 2010-05-01
I want to make a delimited file and send the results to notepad.  Each record needs to be displayed on a new line.  Is there an easy way to do this?
0
Comment
Question by:jennifere
  • 2
  • 2
  • 2
  • +3
9 Comments
 
LVL 1

Expert Comment

by:swdld
ID: 9771472
Hi,
1) write your logs into a local file like 'C:\try.txt'
2) start the file in notepad with
   'shell notepad C:\try.txt'
3) Notepad will start with the file shown which contains your logs

Note: Writing new logs into the file while notepad shows the file will not make any 'updates' within notepad. For having dynamic overview on your logs use a listbox or something like this.

C.U.,
swdld
0
 
LVL 1

Expert Comment

by:jayh99
ID: 9771664
Why don't you store the items you want to send to notepad in variables, then try:

Public strStored As String

Private Sub Command1_Click()
strStored = "Put the information from your delimited file here"
Open "C:\Notepad.txt" For Append As #1
Write #1, strStored
Close #1
End Sub
0
 

Author Comment

by:jennifere
ID: 9771910
I am sending a lot of data to notepad.  This data is stored in a collection and is going to to executed in a for loop, therefore, - I'm assuming here, re-opening and closing the file may be slow.  I tryed using Shell to open Notepad.  Notepad opens okay, but I am unsure how to write my data to it.....
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 26

Expert Comment

by:EDDYKT
ID: 9772011
0
 
LVL 9

Accepted Solution

by:
TooKoolKris earned 125 total points
ID: 9773022
Here is a script (.vbs) you could use. No need to close the file until you're done with it.

Sub OpenTextFileTest
   Const ForReading = 1, ForWriting = 2, ForAppending = 8
   Dim fso, f
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.OpenTextFile("c:\testfile.txt", ForAppending, True)
   f.WriteLine "Hello world!"
   f.Close
End Sub
0
 

Author Comment

by:jennifere
ID: 9773379
Thanks TooKoolKris.  That works!   =)
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9773468
Is it necesary to use notepad? Why don't you simply append lines to a text box control.
If not, EDDY has an excelent workaround with that link.
TooKoolKris, i don't see how it would be useful, there is no code to "update" notepad there.
0
 
LVL 9

Expert Comment

by:TooKoolKris
ID: 9773547
Well I guess it's not very important to see why it would be useful to you it's jennifere who needs to use it. When she adds this to here loop statement it will append the current .txt file with a new line for each record. Notepad is not needed. The only thing that need to be updated(appended) is the text file.
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9773594
Rich,


May be I mis-read the question.

?8->
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question