Hocam aklıma gelen takılan herşeyi soruyorum hakkınızı helal edin
Yukarıdaki soruma ilave olarak
Satır diye bir yer imi var ve ben buraya bir 35 harflik bir değer atadım
1) bu atanan değerin 15 ile 20 inci harfleri işaretletip bunu kalın yapmak istersem
2) bu 35 harflik değeri tamamını koyu ve altı çizgili bundan sonraki aynı yerimine devam olarak atanacak diğer değeri altı çizgili ve koyu olmadan nasıl yazdırabilirim (katılanlar gibi tablo lu olmadan) saygılarımla
Hocam
Dim myRange As Range
Set myRange = ActiveDocument.Range(Start:=0, End:=10)
MyRange. Bold = True
Bu kodla istediğim aralığı kalın yazdırabiliyorum fakat program açıldığı zaman 1 kez ilk kullandığım değeri yapıyor ama program aktifte iken sonraki kullanılan değerlere yapmıyor
Nasıl hepsine yaptırabilirim
Merhaba, örnek uygulamanızı ve word şablonunu eklerseniz inceleyip çözüm arayabiliriz.
(02/08/2018, 09:41)ozanakkaya yazdı: [ -> ]Merhaba, örnek uygulamanızı ve word şablonunu eklerseniz inceleyip çözüm arayabiliriz.
Dosya ve bilgiyi ekte gönderdim hocam
Arkadaşlar word şablona gönderme Vb / makro kodları kullanarak gönderme faydası olabileceğini düşündüğüm derlediğim bazı notlar
Faydası olması dileğimle
-------- Tek Satır Silmek ----------------
Selection.Delete Unit:=wdCharacter, Count:=1
‘ -------- 3 Satır işaretleyip Silmek ----------------
Selection.MoveDown Unit:=wdLine, Count:=3, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
‘ -------- Paragraf ekleyip kelime eklemek ----------------
Selection.TypeParagraph
Selection.TypeText Text:="Eklenecek Metin"
‘ -------- 5 Paragraf işaretleyip Kesmek ----------------
Selection.MoveDown Unit:=wdLine, Count:=5, Extend:=wdExtend
Selection.Cut
‘--------- Yer İmi Ekleme --------------
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, Name:="Satır1"
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
Selection.TypeParagraph
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, Name:="Satır2"
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
‘------------ Yer İmi Silme
ActiveDocument.Bookmarks("Satır2").Delete
With ActiveDocument.Bookmarks
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
‘------------- Yer İmine Gitmek ----------------
Selection.GoTo What:=wdGoToBookmark, Name:="Satır2"
With ActiveDocument.Bookmarks
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
‘------- Cümlenin başı sonu kelime ekleme
Selection.HomeKey Unit:=wdLine
Selection.TypeText Text:="Başa Git "
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=" Sona Git"
‘-------Cümlenin Başından sonuna işaretleme Kalın ve alt çizgili yap
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Font.Bold = wdToggle
Selection.Font.UnderlineColor = wdColorAutomatic
Selection.Font.Underline = wdUnderlineSingle
‘-------Cümlenin Başından sonuna işaretleme Kalın ve alt çizgi kaldırma
Selection.HomeKey Unit:=wdLine, Extend:=wdExtend
Selection.Font.Bold = wdToggle
If Selection.Font.Underline = wdUnderlineNone Then
Selection.Font.Underline = wdUnderlineSingle
Else
Selection.Font.Underline = wdUnderlineNone
End If
Selection.MoveRight Unit:=wdCharacter, Count:=1
‘------------- Seçimi kalın ve alt çizgili yapar ve iptal eder
Selection.Font.Bold = wdToggle
Selection.Font.UnderlineColor = wdColorAutomatic
Selection.Font.Underline = wdUnderlineSingle
Selection.Font.UnderlineColor = wdColorAutomatic
Selection.Font.Underline = wdUnderlineNone
Selection.Font.Bold = wdToggle
‘-----------Mosue ile Seçimi kalın ve alt çizgili yapar ve iptal eder
Selection.Font.Bold = wdToggle
Selection.Font.UnderlineColor = wdColorAutomatic
Selection.Font.Underline = wdUnderlineSingle
Selection.Font.Bold = wdToggle
Selection.Font.UnderlineColor = wdColorAutomatic
Selection.Font.Underline = wdUnderlineNone
‘-------------------- İşaretleyerek seçim
Selection.MoveRight Unit:=wdCharacter, Count:=28, Extend:=wdExtend
Selection.Font.Bold = wdToggle
Selection.Font.UnderlineColor = wdColorAutomatic
Selection.Font.Underline = wdUnderlineSingle
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Font.Bold = wdToggle
Selection.Font.UnderlineColor = wdColorAutomatic
Selection.Font.Underline = wdUnderlineNone
‘-----------Seçilen yere Hafızadakini yapıştırma
Selection.PasteAndFormat (wdFormatOriginalFormatting)
‘-----------Seçilen yere Yazı yazdırma
Selection.TypeText Text:="Eklenecek Metin"
‘------- yazıyı Ayarları ----------------
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter ‘------ Yazıyı ortala
Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft ‘------ Sola Yasla
Selection.ParagraphFormat.Alignment = wdAlignParagraphRight‘------ Sağa Yasla
Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify ‘------- 2 yana yasla
‘----------------Metnin başına tab ekleme
Selection.TypeText Text:=vbTab
‘------------------ İlk Karakteri seçip silme
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
‘------------------ İlk 3 karakteri seçip silme
Selection.MoveRight Unit:=wdCharacter, Count:=3, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
‘-------- İlk Üç Cümleyi seç Kalın ve altı çizgili yap ------
Selection.MoveRight Unit:=wdWord, Count:=3, Extend:=wdExtend
Selection.Font.Bold = wdToggle
If Selection.Font.Underline = wdUnderlineNone Then
Selection.Font.Underline = wdUnderlineSingle
Else
Selection.Font.
Underline = wdUnderlineNone
End If
‘-------- İlk Üç Cümlenin sonuna 2 tab ve 2 nokta üstüste ekle sonra seç Kalın ve altı çizgili yap sonra kalın ve altı çizgiyi iptal et ------
Selection.MoveRight Unit:=wdWord, Count:=3
Selection.TypeText Text:=vbTab & vbTab & ":" ’sonuna tab ve : ekle
Selection.MoveLeft Unit:=wdCharacter, Count:=38, Extend:=wdExtend
If Selection.Font.Underline = wdUnderlineNone Then
Selection.Font.Underline = wdUnderlineSingle
Else
Selection.Font.Underline = wdUnderlineNone
End If
Selection.Font.Bold = wdToggle
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Font.Bold = wdToggle
If Selection.Font.Underline = wdUnderlineNone Then
Selection.Font.Underline = wdUnderlineSingle
Else
Selection.Font.Underline = wdUnderlineNone
End If
‘-------- Cümlenin sonun git kelime ekle------
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:="Eklenecek Metin"
‘-------- Cümlenin sonun git Kalın ve altı çizgiyi iptal et kelime ekle------
Selection.EndKey Unit:=wdLine
Selection.Font.Bold = wdToggle
If Selection.Font.Underline = wdUnderlineNone Then
Selection.Font.Underline = wdUnderlineSingle
Else
Selection.Font.Underline = wdUnderlineNone
End If
Selection.TypeText Text:="Eklenecek Metin"
‘-------- Sayfa Kenar Ayarlarını (Çetveli Ayarlama ------
Selection.PageSetup.LeftMargin = CentimetersToPoints(2.25)
Selection.PageSetup.LeftMargin = CentimetersToPoints(2)
Selection.PageSetup.LeftMargin = CentimetersToPoints(1.75)
Selection.PageSetup.LeftMargin = CentimetersToPoints(1.5)
Selection.PageSetup.LeftMargin = CentimetersToPoints(1.25)
Selection.PageSetup.LeftMargin = CentimetersToPoints(1)
Selection.PageSetup.LeftMargin = CentimetersToPoints(1)
Selection.PageSetup.RightMargin = CentimetersToPoints(2.5)
Selection.PageSetup.RightMargin = CentimetersToPoints(2.25)
Selection.PageSetup.RightMargin = CentimetersToPoints(2)
Selection.PageSetup.RightMargin = CentimetersToPoints(1.75)
Selection.PageSetup.RightMargin = CentimetersToPoints(1.5)
Selection.PageSetup.RightMargin = CentimetersToPoints(1.25)
Selection.PageSetup.RightMargin = CentimetersToPoints(1)
Selection.PageSetup.RightMargin = CentimetersToPoints(0.75)
Selection.PageSetup.RightMargin = CentimetersToPoints(0.75)
Selection.PageSetup.TopMargin = CentimetersToPoints(2.25)
Selection.PageSetup.TopMargin = CentimetersToPoints(2)
Selection.PageSetup.TopMargin = CentimetersToPoints(2)
Selection.PageSetup.TopMargin = CentimetersToPoints(1.75)
Selection.PageSetup.TopMargin = CentimetersToPoints(1.5)
Selection.PageSetup.TopMargin = CentimetersToPoints(1.5)
ActiveWindow.ActivePane.VerticalPercentScrolled = -167
Selection.PageSetup.BottomMargin = CentimetersToPoints(2.25)
Selection.PageSetup.BottomMargin = CentimetersToPoints(2)
Selection.PageSetup.BottomMargin = CentimetersToPoints(2)
Selection.PageSetup.BottomMargin = CentimetersToPoints(1.75)
Selection.PageSetup.BottomMargin = CentimetersToPoints(1.5)
Selection.PageSetup.BottomMargin = CentimetersToPoints(1.25)
Selection.PageSetup.BottomMargin = CentimetersToPoints(1.5)
Selection.PageSetup.BottomMargin = CentimetersToPoints(1.25)
Selection.PageSetup.BottomMargin = CentimetersToPoints(1)
Selection.PageSetup.BottomMargin = CentimetersToPoints(1)
Selection.PageSetup.BottomMargin = CentimetersToPoints(1)
‘-------- 1.5 inç Sayfa Kenar Çizgisi Ekleme ------
With Selection.Sections(1)
With .Borders(wdBorderLeft)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth150pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderRight)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth150pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderTop)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth150pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderBottom)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth150pt
.Color = wdColorAutomatic
End With
With .Borders
.DistanceFrom = wdBorderDistanceFromPageEdge
.AlwaysInFront = True
.SurroundHeader = True
.SurroundFooter = True
.JoinBorders = False
.DistanceFromTop = 24
.DistanceFromLeft = 24
.DistanceFromBottom = 24
.DistanceFromRight = 24
.Shadow = False
.EnableFirstPageInSection = True
.EnableOtherPagesInSection = True
.ApplyPageBordersToAllSections
End With
End With
With Options
.DefaultBorderLineStyle = wdLineStyleSingle
.DefaultBorderLineWidth = wdLineWidth150pt
.DefaultBorderColor = wdColorAutomatic
End With
‘-------- 1.5 inç Sayfa Kenar Çizgisi silme_kaldırma ------
With Selection.Sections(1)
.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
.Borders(wdBorderRight).LineStyle = wdLineStyleNone
.Borders(wdBorderTop).LineStyle = wdLineStyleNone
.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
With .Borders
.DistanceFrom = wdBorderDistanceFromPageEdge
.AlwaysInFront = True
.SurroundHeader = True
.SurroundFooter = True
.JoinBorders = False
.DistanceFromTop = 24
.DistanceFromLeft = 24
.DistanceFromBottom = 24
.DistanceFromRight = 24
.Shadow = False
.EnableFirstPageInSection = True
.EnableOtherPagesInSection = True
.ApplyPageBordersToAllSections
End With
End With
With Options
.DefaultBorderLineStyle = wdLineStyleSingle
.DefaultBorderLineWidth = wdLineWidth150pt
.DefaultBorderColor = wdColorAutomatic
End With
‘-------- 6 Karakteri İşaretleyip Renk Değiştirme ------
‘---- Unit:=wdWord, Count:=2 (2) Cümle
‘---- Unit:=wdCharacter, Count:=6 (6) harf
Selection.MoveRight Unit:=wdCharacter, Count:=6, Extend:=wdExtend
Selection.MoveRight Unit:=wdCharacter, Count:=1
‘-------- 6 Karakteri İşaretleyip Büyük Harfe Çevirme ------
Selection.MoveRight Unit:=wdCharacter, Count:=6, Extend:=wdExtend
Selection.Range.Case = wdUpperCase
Selection.MoveRight Unit:=wdCharacter, Count:=1
‘-------- 2 Cümleyi İşaretleyip Küçük Harfe Çevirme ------
Selection.MoveRight Unit:=wdWord, Count:=2, Extend:=wdExtend
Selection.Range.Case = wdLowerCase
Selection.MoveRight Unit:=wdCharacter, Count:=1
‘-------- 2 Cümleyi İşaretleyip Başharfleri Büyük Yapma Harfe Çevirme ------
Selection.MoveRight Unit:=wdWord, Count:=2, Extend:=wdExtend
Selection.Range.Case = wdTitleWord
Selection.MoveRight Unit:=wdCharacter, Count:=1
Merhaba, eklediğiniz örnekteki 1. butondaki kodda sıkıntı görünmüyor.
Rich Text formatındaki veriyi worde aktarırken kodu aşağıdaki ile değiştirmelisin
WordApp.Selection.Text = PlainText(Me.Uzlaşma_sonucu)
Ayrıca, veri aktardıktan sonra iki yana yaslamak için ise üstteki kodun hemen altına
WordApp.Selection.Paragraphs.Alignment = wdAlignParagraphJustify
kodu eklemelisin.