Main Menu

HOME

.Net
ASP
Assembly
C
C++
Delphi
HTML
Java
JavaScript
MySQL
PC interface
Powershell
Perl
PHP
VBScript
Visual Basic
XML

US Job listings




   Misc

   Amazon

   Links

    


Create a word document

 

 Add a reference to the Word object library . Project / References . Then scroll down and place a tick beside the Microsoft Word object library.

Place a command button on a form.

Private Sub Command1_Click()
Dim objWord As Word.Document
Dim result As Integer
Set objWord = New Word.Document
With objWord.ActiveWindow.Selection
'text in document
.TypeText "This is some sample text"
'new paragraph
.TypeParagraph
.TypeText "This is some more text"
.TypeParagraph
result = MsgBox("Word Document Created Successfully", vbInformation, "WD Created")
End With
With objWord
'save document location
.SaveAs "h:\mysampledoc.doc"
.Close
End With
'destroy word object
Set objWord = Nothing
End Sub

 

 

 

 

 




   Sponsors
 

   Software
500 Java Tips E-book
PHP editor
PERL editor
Beginning Java
Beginning Visual Basic
Learn VB.net
Learn VB 6
VB and databases
ASP image library
C++ builder programming
C++ fundamentals

   Source Code
Bubblesort routine(PHP)
event logs to an excel spreadsheet(VBScript)
Delete a file(ASP)
This program deletes a folder(VB)
display the cookies present(VBScript)
count characters in a sentence(PHP)
Degrees / Radians conversions(ASP)
MP3 searcher(VBScript)

    




Copyright © 2003 by programmershelp.co.uk