• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Date degistirme problemi

Katılım
4 Temmuz 2006
Mesajlar
239
Arkadaslar elimdeki dosyada cok sayida degisk Bookmark var. Bu bu bookmarklardan birtanesi "Date" bookmarki fakat bazen kullanicilar yanlislikla "Date" bookmarkini silip dosyayi oyle kaydediyor.

Ben tekrar o dosyayi acip tarhi macroyla degitirmek istiyorum. Asagidaki kodda yapmak
istedigim eger "Date" bookmark varsa onu sec ve Insert Date komutuyla tarigi guncellemek. Macronun bu kismi gayet guzel calisiyor. Yani "Date"bookmarki silinmemisse bir sorun yok.

Ama benim problemim eger "Date" bookmarki yoksa tarhi degistiremiyorum. Komutun "If ActiveDocument.Bookmarks.Exists("Date") = False Then" kismi calismiyor.

neden acaba? yardimci olabilirmisiniz.

If ActiveDocument.Bookmarks.Exists("Date") = True Then
Selection.GoTo What:=wdGoToBookmark, Name:="Date"
Selection.InsertDateTime DateTimeFormat:="dd MMMM yyyy", InsertAsField:= _
False, DateLanguage:=wdEnglishUK, CalendarType:=wdCalendarWestern, _
InsertAsFullWidth:=False
Selection.Find.ClearFormatting


With ActiveDocument.Bookmarks
If ActiveDocument.Bookmarks.Exists("Date") = False Then
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Tax Point:"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCharacter, Count:=3
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.InsertDateTime DateTimeFormat:="dd MMMM yyyy", InsertAsField:= _
False, DateLanguage:=wdEnglishUK, CalendarType:=wdCalendarWestern, _
InsertAsFullWidth:=False
End If
End With



Saygilar
 
Son düzenleme:
Selamlar,

Sanıyorum siz bu makro kodunu Word dosyasında kullanıyorsunuz. Sorunuzu örnek dosya ile desteklerseniz yardım etmemiz kolaylaşır.
 
sagolun arkadaslar dosysyi ekledim.

makro bolumunde test2 user formu var onunla hem "invoice no" su girmeye calisiyorum hemde "Date" degistiyorum.

bookmarklar orginal template oldugu icin burdada goremeyebilirsiniz.

saygilar
 

Ekli dosyalar

Geri
Üst