Excel nach Word
ing.grohn
ich übertrage häufig Daten von Excel nach Word, bearbeite den Text in Word und kehre nach Excel zurück.
Funktioniert eigentlich gut (unter XP), aber:
neuerdings erhalte ich eine Meldung die das schließen einer Session von Word behindert (unter Win7):
Ich rufe die Word-Session wie folgt auf:
Sub Text()
On Error Resume Next
Set ObjWord = GetObject("Word.Application")
If ObjWord Is Nothing Then
Set ObjWord = CreateObject("Word.Application")
ObjWord.Visible = True
End If
On Error GoTo 0
If Not ObjWord Is Nothing Then
Set DocNeu = ObjWord.Documents.Add(Template:= _
Workbooks("Jutta.xls").Sheets("Konstanten").Range("aLW").Value _
& Workbooks("Jutta.xls").Sheets("Konstanten").Range("Vorlagen").Value _
& Workbooks("Jutta.xls").Sheets("Konstanten").Range("Brief").Value)
End If
With DocNeu
End With
On Error Resume Next
DocNeu.Application.ActiveDocument.SaveAs _
Filename:=dateiname, _
FileFormat:=wdFormatDocument, _
LockComments:=False, _
Password:="", _
AddToRecentFiles:=True, WritePassword:="", _
ReadOnlyRecommended:=False, _
EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, _
SaveFormsData:=False, _
SaveAsAOCELetter:=False
' MsgBox "Fehler = " & Err.Number & " " & DateiName
DocNeu.Application.ActiveDocument.Fields.Update
DocNeu.Application.Activate
DocNeu.Application.Selection.MoveDown Unit:=wdLine, Count:=21
Set DocNeu = Nothing
Set ObjWord = Nothing
End Sub
Hat jemand eine Idee wie man das abstellen kann? ist ziemlich nervig.Für eine Antwort bedanke ich mich recht herzlich.
Mit freundlichen Grüßen
Albrecht