word handle

  • Thread starter Thread starter fredvinzenz
  • Start date Start date
F

fredvinzenz

hallo,
mein programm öffnet eine worddatei. dann kann mann diese bearbeiten
und abspeichern. wenn word geschlossen wird soll eine sub ausgeführt
werden.
kann mir jemand helfen?

Private WithEvents mAppEvents As word.ApplicationEvents2_Event
Private Sub word_open(ByVal dokname As String)
word = CreateObject("Word.Application")
word.Documents.Open(dokname)
word.Visible = True
word.Activate()

word = Nothing
mAppEvents = word

End Sub

Private Sub word_quit() Handles mAppEvents.DocumentEvents_Event_Close
// geht nur einmal
MsgBox("quit")
End Sub
 
Hi Fred,

This is a newsgroup where, although there are much non native English
speakers active, by convention English is used. I thougth that when it is
about Word interop mostly are the English speakers who give the answers.

The German VB language group is as very good newsgroup, when English is a
problem.

I have here some links.

Office
http://support.microsoft.com/default.aspx?scid=kb;EN-US;311452

http://msdn.microsoft.com/office/

Pia Download
http://www.microsoft.com/downloads/...1e-3060-4f71-a6b4-01feba508e52&displaylang=en

And maybe Scorpion can help you, this is a page from him.
http://www.kjmsolutions.com/datasetarray.htm

However I am almost sure that by instance he cannot help you when it is in
the German language.

I hope this helps?

Cor
 
i hope everybody can understand my "english"

hallo,
my programm opens a wordfile. After this you can work with the file
and save it. if word is being closed a sub should be started.
can sombody help me?

Private WithEvents mAppEvents As word.ApplicationEvents2_Event
Private Sub word_open(ByVal dokname As String)
word = CreateObject("Word.Application")
word.Documents.Open(dokname)
word.Visible = True
word.Activate()

word = Nothing
mAppEvents = word

End Sub

Private Sub word_quit() Handles mAppEvents.DocumentEvents_Event_Close
// only works onetime
MsgBox("quit")
End Sub
 
Hi Fred,

Is the Sub a program or A Sub (void function), processing the Sub seems not
that difficult in my opinion, so it is for me hard to understand what you
are after. That was it as well in the German language for me, from which I
could understand the text, however not the question.

Cor.
 
i want a sub running after a user closed a word document.

Private Sub word_open(ByVal dokname As String, ByVal patientenname
As String, ByVal abgeschlossen As Boolean)

Dim word_app As New Word.Application()
dok_offen = True
'word_app = CreateObject("Word.Application")
'Set Word = GetObject(, "Word.Application")



MsgBox(abgeschlossen)
If abgeschlossen = False Then
'normal öffnen
mAppEvents = word_app.Documents.Open(dokname)
Else
'schreibgeschützt öffnen
mAppEvents = word_app.Documents.Open(dokname,
ReadOnly:=True)
End If

word_app.Visible = True
word_app.Activate()
word_app.Caption = ""
word_app.Caption = patientenname

word_app = Nothing

'MsgBox("quit")
End Sub
'string an wenn word geschlossen wird

Private Sub word_quit() Handles
mAppEvents.DocumentEvents_Event_Close
MsgBox("quit")
sql = "UPDATE doc_briefe SET offen = '0' WHERE pfad = '" &
ds_dok2.Tables(0).Rows(0).Item(3) & "'"
MsgBox(sql)
SqlCom = New SqlCommand(sql, SqlCon)
SqlCom.ExecuteNonQuery()
'word_app.Documents.Close()

'mAppEvents.Close()
'mAppEvents.ResetFormFields()

dok_offen = False
End Sub
 
Hi Fred,

I think I completly misunderstand you and this is also not the subject what
is the most liked in this newsgroup.

If I understand you well, than you want:
- to make a Word document using interop
- let the user add information to that Word document using MS word
- when the user closes the document get the typed information in your
application
- use that typed word information and set it in a database

I have not done this yet.

However here some links and otherwise try it again in this newsgroup with
the text above, in my idea gives that a shorter idea what you want when my
text is right.

Office
http://support.microsoft.com/default.aspx?scid=kb;EN-US;311452

http://msdn.microsoft.com/office/

Pia Download
http://www.microsoft.com/downloads/...1e-3060-4f71-a6b4-01feba508e52&displaylang=en

Sorry that I could not help you with more information.

Cor
 
Back
Top