|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Exporting text in text boxes in vb 6.0
Hi all
Could someone help me with this? I am trying export text in text boxes to the notepad application, so I can save and print the text generatored by my VB 6.0 application. I have upload a form image of my application to help explain in more detail.To view this image click the link below URL Thank you for the help in advance Mark |
|
#2
|
||||
|
||||
|
Hi Mark,
I dont know how to do this with Notepad, but the following will work with Word, just replace Text1 with the name of your text box: Code:
Dim oWord As Object
Dim oDoc As Object
Set oWord = CreateObject("word.application")
Set oDoc = oWord.Documents.Add()
'Add text to the document.
oWord.Selection.TypeText Text1.Text
'Display MS-Word.
oWord.Visible = True
|
|
#3
|
||||
|
||||
|
If all you wanted to do was to save the information in a notepad file for use at a later stage, but you dont necessarily need to view the document straight away you can simply create a text file:
Code:
Dim outputstring as string outputstring = Text1.Text Open "C:/MyNotepadDocument.txt" For Output As #1 Print #1, outputstring Close #1 |
|
#4
|
|||
|
|||
|
Exporting text in text boxes in vb 6.0
Quote:
Hi Thanks alot that works great. Just one other thing, How do I get the text to appear in word on seperate lines? Thanks once again for the help Mark |
|
#5
|
||||
|
||||
|
Hi Mark,
Thanks for the compliment, I'm glad it worked!! To get the text to appear on different lines you need to use a Carriage Return character: Code:
oWord.Selection.TypeText Text1.Text & vbCrLf oWord.Selection.TypeText Text2.Text & vbCrLf oWord.Selection.TypeText Text3.Text |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Exporting text in text boxes in vb 6.0 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|