|
-
Jan 11th, 2002, 02:48 PM
#1
Thread Starter
Junior Member
Create and SHOW new text document
I know this is a stupid question but I can't figure out how to do it. I have an application that allows the user to look at a text box with results from a query in it.
I want to give the user the ability to create a text document with the info in it. I have searched the forum and can't find an answer.
I want to know how to create the document, add the info AND THEN SHOW IT SO THE USER WILL THEN SEE IT IMMEDIATELY.
Please help.
-
Jan 11th, 2002, 03:04 PM
#2
Frenzied Member
Add a reference to the Microsoft Word 8 object library
and then add the following
VB Code:
Dim app As Word.Application
Set app = CreateObject("Word.Application")
app.Visible = True
app.Documents.Add
app.Selection.TypeText Text1.Text ' Your text box info
Mega.
"If at first you don't succeed, then skydiving is not for you"
-
Jan 11th, 2002, 03:15 PM
#3
Thread Starter
Junior Member
Thanks mega,
I am familar with creating a word doc. though. I am trying to create a txt file so that it will work on any system. I can create the file but I want the user to see it immediately.
Any ideas?
-
Jan 11th, 2002, 03:17 PM
#4
Frenzied Member
Try,
VB Code:
Shell "Notepad.exe filename", vbNormal
-
Jan 11th, 2002, 03:25 PM
#5
Frenzied Member
VB Code:
Open "c:\textfile.txt" For Output As #1
Write #1, Text1.Text ' Your text box
Close #1
Shell "Notepad.exe c:\textfile.txt", vbNormal
This is a very quick way. I would personally use the FileSystemObject to do it properly but this will achieve what you want.
Mega.
Last edited by Mega_Man; Jan 11th, 2002 at 03:31 PM.
"If at first you don't succeed, then skydiving is not for you"
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
|