Msword

K

krishna murthy

Hi,
I have a doubt.
I have to open a predefined templet using VB.NET whenever
i apply a button click and at the same time i have to add
some data to the predefined templet using VB.NET i.e
handling the The word document through VB.NET code.
plz help me.


Regards,
krishna.
 
C

Cor Ligthert

Krishna,

Please keep in the original thread, in this way answering you give the ones
who answer more work, because they don't know what was already answered.

Cor
 
M

Mona\(Grapecity\)

Hi Krishna,

You can go through the following code snippet to see if it helps you

Public Function StartWord() As Word.Application
Dim wrdTmp As Word.Application
On Error Resume Next

Set wrdTmp = GetObject(, "Word.Application")
If Err.Number <> 0 Then
'Using New here would work just the
'same as using CreateObject, but I wanted
'it to be parallel for the other function.
Set wrdTmp = CreateObject("Word.Application")
End If
Set StartWord = wrdTmp
End Function

To use the function, write code like this (after you've set a reference to
Word in your application) in your button click event:

Dim wrdApp As Word.Application
Set wrdApp = StartWord()

HTH

Mona
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top