![]() |
VB6 Question
I'm looking for a way to save a text box to a MSWord .doc using VB6. I've tried some things but they aren't working. If I can get it to work I also need to set margins and font size and font name.
I'd Appricate any help I can get with this. |
Re: VB6 Question
There are two methods to do this:
1. Save the file in RichText format (.rtf). This can be read using Word. Put a RichTextBox on a form, insert the text into the RichTextBox control, and use the SaveFile method of the RichTextBox. 2. If you want to save it in .doc format directly, go here: http://support.microsoft.com/default...12&Product=vbb It explains exactly how to do it in the More Information section. |
Re: VB6 Question
Wow. I would have used VBA or something. Nice!
|
Re: VB6 Question
Quote:
|
Re: VB6 Question
First, add a reference to the "Microsoft Word 10.0 Object Library" from the Project->References menu.
This subgroutine will create a new word document and write a block of text to it: Code:
Sub WriteWordDoc(content As String, _ |
Re: VB6 Question
Quote:
|
Re: VB6 Question
I would suggest you try using C# or VB.NET if you're just getting started with VB. The VS 6.0 tools won't be supported forever and you can do everything (and a lot more) with the .NET SDK.
Here is a sample class that has a method to save the information to a Word document. It only has two properties, Name and Bio. The Name will be written in 12pt Bold and the Bio in 10pt normal font. There is an overload that defaults to hiding and closing Word. Code:
public class Person |
| All times are GMT -5. The time now is 02:52. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi