AW: Wordvorlage aus Excel starten
01.03.2005 14:26:31
René
Hallo Chris
Zwei Ansätze die ich anwende:
Viel Spass und Gruss René
1)
=================================
Im Excel
=================================
Dim DocStart
Speichervorgang_starten
DocStart = Shell("Winword.exe " & "vsr_vorlage.doc", vbMaximizedFocus)
Application.ActiveWorkbook.Saved = True
Application.Quit
=================================
Im Word
=================================
Code unter AutoOpen
Option Explicit
Public strStartAktPath As String
Public strStartDotFile As String
Public strStartAktDoc As String
Sub Starten_Beispiel()
' Ermitteln des aktuellen Dateinamens
strStartAktDoc = ActiveDocument.Name
' Ermitteln des aktuellen Pfades
strStartAktPath = ActiveDocument.Path
strStartDotFile = strStartAktPath & "\vst_vorlage.dot"
' Neues Dokument basierend auf der Dokumentvorlage erstellen
Application.Documents.Add strStartDotFile
' Dokument schliessen
Documents(strStartAktDoc).Close SaveChanges:=wdDoNotSaveChanges
End Sub
2)
Dim objWord As Object
Set objWord = CreateObject("word.application")
On Error GoTo Ende
objWord.Visible = True
objWord.Documents.Add "vst_vorlage.dot"
Set objWord = Nothing
Exit Sub
Ende: