Excelden worda alan yapıştırp kaydettikten sonra wordu kapama

Katılım
2 Mart 2005
Mesajlar
2,960
Excel Vers. ve Dili
ev: Ofis 2007- Win Xp
iş: Ofis 2010- Win Vista
Kod:
Sub Alansec()
    Range("A3:j82").Copy
    strAd = ThisWorkbook.Path & "\" & ActiveSheet.Name & "-" & Format(Now, "dd-mm-yy h-mm-ss") & ".doc"
    Call SeciliAlaniWordeYapistir(42.55, 42.55, 25, 25, False, strAd)
End Sub


Sub SeciliAlaniWordeYapistir(ust, alt, sol, sag As Integer, yon As Boolean, kytAd)
'A4 sayfası
Application.ScreenUpdating = True
    'Range("A1:L5" & SnDlSt + 7).Copy
    Dim objword As Object
    Set objword = CreateObject("Word.Application")
    Set Mydoc = objword.Documents.Add(DocumentType:=wdNewBlankDocument)
    objword.Visible = True
    
    With Mydoc.PageSetup
        .TopMargin = ust '42.55
        .BottomMargin = alt    '42.55
        .LeftMargin = sol     '25#
        .RightMargin = sag    '25#
        If yon = True Then
            .PageWidth = 595.35 'CentimetersToPoints(21)     'dikey
            .PageHeight = 841.95 'CentimetersToPoints(29,7)  'dikey
        Else
            .PageWidth = 841.95 'CentimetersToPoints(29.7)   'yataysayfa
            .PageHeight = 595.35 'CentimetersToPoints(21)    'yataysayfa
        End If
    End With
    objword.Selection.PasteSpecial Link:=False, DataType:=10
    Application.CutCopyMode = False

    
    If kytAd <> "" Then
       objword.ActiveDocument.SaveAs kytAd
    End If
    
'    objword.ActiveDocument.Close
Set objword = Nothing:      Set Mydoc = Nothing
Application.ScreenUpdating = False
End Sub
kodları ile Alan tanımlayıp
worda yapıştırp ve kaydedeip belgeyi kapatabiliyorum. Ancak wordu nasıl kapatabilirm yardımcı olurmuısunuz?
 

Haluk

𐱅𐰇𐰼𐰚
Katılım
7 Temmuz 2004
Mesajlar
12,327
Excel Vers. ve Dili
64 Bit 2010 - İngilizce
+
Google Sheets
+
JScript
Altın Üyelik Bitiş Tarihi
Denemedim ama;

Kod:
'    objword.ActiveDocument.Close
sat&#305;r&#305;n&#305;n ba&#351;&#305;ndaki kesme i&#351;aretini kald&#305;r&#305;n &#246;nce...

Sonra da, MS Word uygulamas&#305;n&#305; kapatmak i&#231;in a&#351;a&#287;&#305;dakini ilave edin ...

Kod:
objword.Quit
 
Katılım
2 Mart 2005
Mesajlar
2,960
Excel Vers. ve Dili
ev: Ofis 2007- Win Xp
iş: Ofis 2010- Win Vista
te&#351;ekk&#252;rler sn. hocam
 
Katılım
2 Mart 2005
Mesajlar
2,960
Excel Vers. ve Dili
ev: Ofis 2007- Win Xp
iş: Ofis 2010- Win Vista
birde hocam
' TempFilePath = Environ$("temp") & "\"

sat&#305;r&#305;n&#305;n Belgelerim kar&#351;&#305;l&#305;&#287; nedir
 
Üst