web development India freelance website designer
Passing value from Visual Basic Application to MS Word (Document or Template) ' This code is for MS Word 7.0 and
higher versions if you are trying on lower ' version you should use CreateObject("Word.Basic") instead of CreateObject
'("Word.Application") and use the corresponding methods and properties

' From Project References include Microsoft Word 9.0 Object Library
' The above one is for VB6 Check out for other versions

Dim WordObj As Word.Application
Dim WordDoc As Word.Document
Dim WordRange As Word.Range

Private Sub Form_Load()
Set WordObj = CreateObject("Word.Application")
' (.dot is a word template you can also use .doc a word document)
Set WordDoc = WordObj.Documents.Open("c:\test.doc")
WordObj.Visible = True
' Create a bookmark 'name' in the test.dot template or test.doc document
' The below code will place the text in the bookmarked location
Set WordRange = WordDoc.Goto(What:=wdGoToBookmark, Name:="name")
WordRange.InsertAfter "Max"
Set WordObj = Nothing
End Sub
Passing value from Visual Basic Application to MS

1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700

Freelance ASP PHP web development | Web developer India Web development India| Prayagasoft - web designer India, Ecommerce developer india, Ecommerce design