Convert from VB6.0 to Word
Submitted by donbermoy on Saturday, April 5, 2014 - 12:39.
In this tutorial, we will create a program that can convert the inputted textbox in vb6.0 into a Word Document.
Now, let's start this tutorial!
1. Let's start this tutorial by following the following steps in Microsoft Visual Basic 6.0: Open Microsoft Visual Basic 6.0, click Choose Standard EXE, and click Open.
2. Next, add only one Button named Command1 and labeled it as "Convert to Word". Add also TextBox named Text1 for our input and displayed it in Microsoft Word. You must design your interface like this:
3. Now put this code for your code module. This code is for Command1_Click:
- Private Sub Command1_Click()
- Dim WordSC As Object
- Set WordSC = CreateObject("Word.Basic")
- WordSC.appMaximize
- WordSC.FileNewDefault
- WordSC.Insert Text1.Text
- WordSC.StartOfDocument
- Text1.Text = WordSC.Selection
- End Sub
Explanation:
We have initialized first variable WordSC as an Object then later on we set this variable to create an object as a Word Document.. Word.Basic is the name of the application that we have to call and display after clicking the button. appMaximize property will first set your Word Document as maximizing it. FileNewDefault is for creating a new Word Document. Insert Text1.Text will insert the content of the inputted text in the Textbox. StartOfDocument will start opening the Word Document. And this Selection property of the Word Document selects the text of our textbox to be displayed on it.Output:
Download the source code below and try it! :) For more inquiries just contact my number or e-mail below. Best Regards, Engr. Lyndon R. Bermoy IT Instructor/System Developer/Android Developer Mobile: 09488225971 Telephone: 826-9296 E-mail:[email protected] Follow and add me in my Facebook Account: https://www.facebook.com/donzzsky Visit and like my page on Facebook at: https://www.facebook.com/BermzISwareAdd new comment
- 598 views