Solved

Sending text to notepad

Posted on 2003-11-18
9
675 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
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9772011
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now