|
-
Nov 27th, 2002, 03:30 PM
#1
Thread Starter
Junior Member
Printing to Notepad and Open with results (Resolved)
I need a basic example to carry the results of a form to notepad and open notepad with the values passed.
If you could just give me an example of how to print "Hello World!" to Notepad and open Notepad after the value has been passed, then I think I can do the rest myself.
Your help will be appreciated.
Last edited by Willie; Nov 28th, 2002 at 03:57 AM.
Willie
-
Nov 27th, 2002, 03:51 PM
#2
VB Code:
Private Sub Command1_Click()
Dim strTemp1 As String
Dim lngTemp1 As Long
strTemp1 = "C:\Testabcd.txt"
Open strTemp1 For Output As #1
Print #1, "Hello World!"
Close #1
lngTemp1 = Shell("Notepad.exe " + strTemp1, vbNormalFocus)
End Sub
-
Nov 27th, 2002, 03:56 PM
#3
Fanatic Member
The simplest example I can give is:
VB Code:
Text1.text = "Hello World"
Open "C:\[I]FolderName[/I]\[I]FileName[/I].txt" For Output As #1
Print #1, Text1.Text
Close #1
Shell "Notepad.exe C:\[I]FolderName[/I]\[I]FileName[/I].txt", vbNormalFocus
'To Print it
Shell "Notepad.exe /p C:\[I]FolderName[/I]\[I]FileName[/I].txt", vbNormalFocus
There are other ways, this is just the simplest I know
Hope this helps
JO
"I have not failed. I've just found 10,000 ways that won't work."
'Thomas Edison'
"If we knew what it was we were doing it wouldn't be called research, would it?"
'Albert Einstein'
VB6
-
Nov 28th, 2002, 03:57 AM
#4
Thread Starter
Junior Member
Thank you both.
I got it to work and I get the idea. I have one more question about your code.
Why do you Dim the file location as Long? I thought Long was only used for a numeric value?
Why do you both use "for Output as #1"? Could I change #1 to #2 or #3? (or is this just something people do like using i for temporary numeric values? kind of like programming etiquette )
Thanks agian!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|