Skip to main content

AccessTr.neT


Excel'den Belli Bir Klasördeki Tüm Word Dosyalarının Sayfa Yapısını Değiştirmek

Excel'den Belli Bir Klasördeki Tüm Word Dosyalarının Sayfa Yapısını Değiştirmek

#2
Kodu aşağıdaki gibi düzenleyip dener misiniz?
Deneme imkanım olmadı teorik
Option Explicit
Dim Dosya As String

Sub word_sayfa_yapisi()
Dim s As Long
Dim DosyaSay As Long
DosyaSay = WorksheetFunction.CountA(Range("a2:a2000"))

Dim tmpAppWord As Word.Application
Set tmpAppWord = CreateObject("Word.Application")
AppWord.Visible = True

Application.CutCopyMode = False
For s = 1 To DosyaSay
Dosya = Range("A" & 1 + s).Value
SetupPage Dosya, tmpAppWord
        Dosya = ""
Next s
    TmpAppWord.Quit
    Set tmpAppWord = Nothing
   Range("A1").Select
   Application.CutCopyMode = False
End Sub

Sub SetupPage(Dosya As String, AppWord as object)
    AppWord.Documents.Open Dosya
   
    With AppWord.ActiveDocument.PageSetup
        .PageWidth = CentimetersToPoints(9)
        .PageHeight = CentimetersToPoints(29.7)
        .TopMargin = CentimetersToPoints(0.6)
        .BottomMargin = CentimetersToPoints(0.6)
        .LeftMargin = CentimetersToPoints(0.6)
        .RightMargin = CentimetersToPoints(0.6)
    End With
    AppWord.ActiveDocument.Save
    AppWord.ActiveDocument.Close
   
End Sub
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Bu Konudaki Yorumlar
RE: Excel'den Belli Bir Klasördeki Tüm Word Dosyalarının Sayfa Yapısını Değiştirmek - Yazar: berduş - 17/12/2022, 22:13