Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a txt file once it has been saved from VB6

Status
Not open for further replies.

mych

Programmer
May 20, 2004
248
GB
Hi

I have an app that generates some scripts which are saved as text files (although the extention is .sql). What I would like the application to do is open the file in NotePad once it has been saved.

How do I launch Notepad and have it open the file?

My current code for saving the file is....
Code:
Dim strNotepadFile As String

GlbCRLF = Chr$(13) & Chr$(10)

strNotepadFile = GlbSavePath & txtRef & "_" & txtSuffix & ".sql"

txtScript = "declare" & GlbCRLF
txtScript = txtScript & .......

Open strNotepadFile For Output As #1
Print #1, txtScript
Close #1

Many thanks
Mych

 
It's worth noting that there is a VB constant (implicit) for CR + LF.

vbCRLF will return the string containing Chr(13) and Chr(10) so you don't need to set up your own.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 
Cheers Harleyquinn....

John thanks for the VB constant. (You don't happen to know if this is true for VBA too?)

Mych
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top