- 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
worda yapıştırp ve kaydedeip belgeyi kapatabiliyorum. Ancak wordu nasıl kapatabilirm yardımcı olurmuısunuz?