Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old June 21st, 2006, 08:27 AM
jenkinsm jenkinsm is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 2 jenkinsm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 42 m 24 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old June 21st, 2006, 08:41 AM
sync_or_swim's Avatar
sync_or_swim sync_or_swim is offline
Moderator
Click here for more information.
 
Join Date: Mar 2006
Location: South Wales
Posts: 1,932 sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 6 Days 22 h 34 m 58 sec
Reputation Power: 1243
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
Comments on this post
jenkinsm agrees: sync or swim was very helpful, quick response

Reply With Quote
  #3  
Old June 21st, 2006, 08:59 AM
sync_or_swim's Avatar
sync_or_swim sync_or_swim is offline
Moderator
Click here for more information.
 
Join Date: Mar 2006
Location: South Wales
Posts: 1,932 sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 6 Days 22 h 34 m 58 sec
Reputation Power: 1243
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

Reply With Quote
  #4  
Old June 21st, 2006, 10:41 AM
jenkinsm jenkinsm is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 2 jenkinsm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 42 m 24 sec
Reputation Power: 0
Exporting text in text boxes in vb 6.0

Quote:
Originally Posted by sync_or_swim
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

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

Reply With Quote
  #5  
Old June 23rd, 2006, 03:00 AM
sync_or_swim's Avatar
sync_or_swim sync_or_swim is offline
Moderator
Click here for more information.
 
Join Date: Mar 2006
Location: South Wales
Posts: 1,932 sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 4th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 6 Days 22 h 34 m 58 sec
Reputation Power: 1243
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

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Exporting text in text boxes in vb 6.0


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT