Solved

vb5 to word97

Posted on 1998-12-10
3
208 Views
Last Modified: 2010-05-03
Is there a way to convert a form to a text document in word97?   My form contains some a output data, i make a print (print form) but is there a way to print to a file so that word can open it. ( i thougt to make a document in word and make a bookmark, after that vb must to copy the result to the bookmark but it do not work.....) what can i do??
0
Comment
Question by:nimicheck
  • 2
3 Comments
 

Author Comment

by:nimicheck
Comment Utility
Edited text of question
0
 
LVL 3

Accepted Solution

by:
jjmartin earned 100 total points
Comment Utility
There are two ways I know of to export you text to word.  By code, and using the export function of Criystal Reports 6. The code is below, it is pretty basic, and doing any formating can get real complicated.  If you go to www.seagate.com, you can download Crysatl Reports 6 for free.  CR6 has an export function that is pretty easy to use, and does a decent job on formating.  The version of Crystal Reports that comes with VB5 does a terrible job of exporting to word.

'This example open a new word document and write to the file, you must be using Word 95 or 97

Private Sub Command1_Click()
Dim oWord As Word.Application
Dim oDoc As Word.Document

Set oWord = New Word.Application

' Open an existing file this way
'oWord.Documents.Open(...)

' Open a new document
Set oDoc = oWord.Documents.Add

oDoc.Content.InsertAfter "Mary had a little lamb," & vbCrLf & "Her fleece was white as snow"

oDoc.SaveAs "C:\Junk.Doc"
oDoc.Close

Set oWord = Nothing

End Sub

0
 

Author Comment

by:nimicheck
Comment Utility
Thanks,
but an other question, is it possible to export my output data from my form (vb5) to an existing word file by using bookmarks?
How does it work (can you give an example ....)
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now