title image


Smiley Re: Über Excel Word-Fußzeile ändern
Hallo,

versuch es mal damit ( aber erst vorsichtig testen...):















Sub Fusszeile_in_Word_aendern()

Dim strFolder As String  

Dim i As Integer    

Dim objWord As Object  



On Error GoTo Fehler    



Application.ScreenUpdating = False

strFolder = GetAOrdner & "\"  



Set objWord = CreateObject("Word.Application")  

'objWord.Visible = True



With Application.FileSearch

.NewSearch

.LookIn = strFolder

.Filename = "*.doc"

.SearchSubFolders = True  

If .Execute(SortBy:=msoSortByFileName, sortorder:=msoSortOrderAscending) > 0 Then    

    For i = 1 To .FoundFiles.Count  

      objWord.Documents.Open .FoundFiles(i)  

      Set rng = objWord.ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range  

      rng.Text = Cells(2, 2)

      objWord.ActiveDocument.Save

      objWord.ActiveDocument.Close  

    Next i

End If  

End With  



Application.ScreenUpdating = True

objWord.Application.Quit

Set objWord = Nothing  

Set rng = Nothing  



Exit Sub  



Fehler:



Application.ScreenUpdating = True

objWord.Application.Quit

Set objWord = Nothing  

Set rng = Nothing  



    MsgBox "FehlerNr.: " & Err.Number & vbNewLine & vbNewLine _

    & "Beschreibung: " & Err.Description _

    , vbCritical, "Fehler"



End Sub  







Gruß

Alfons

geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: