ich möchte mit Excel den VBA-Code in einer Worddatei zeilenweise komplett auslesen,
jede Zeile bearbeiten und anschließend alles speichern.
Hat jemand dafür einen Quellcode? Dankeschön.
Viele Grüße
Mathias
Sub t()
Dim wdApp As Object, wdDoc As Object
Dim CodeZeile As Long
Set wdApp = CreateObject("Word.Application")
Set wdDoc = wdApp.Documents.Open("C:\Pfad\Dok1.docm")
'wdApp.Visible = True
With wdApp.VBE.VBProjects(1).VBComponents.Item(1).CodeModule
For CodeZeile = 1 To .CountOfLines
Debug.Print .Lines(CodeZeile, 1)
Next CodeZeile
End With
'wdDoc.Close
Set wdApp = Nothing
Set wdDoc = Nothing
End Sub
cu
For i = 1 To wdApp.VBE.VBProjects(1).VBComponents.Count
With wdApp.VBE.VBProjects(1).VBComponents.item(i).CodeModule
cu