AccessTr.neT
Word'de Bul Ve Değiştir - Baskı Önizleme

+- AccessTr.neT (https://accesstr.net)
+-- Forum: Microsoft Access (https://accesstr.net/forum-microsoft-access.html)
+--- Forum: Access Cevaplanmış Soruları (https://accesstr.net/forum-access-cevaplanmis-sorulari.html)
+--- Konu Başlığı: Word'de Bul Ve Değiştir (/konu-word-de-bul-ve-degistir.html)



Word'de Bul Ve Değiştir - berduş - 04/04/2019

Microsoft Word x.x Object Library ekli olmasına rağmen aşağıdaki kod sürekli aynı hatayı veriyor.
butona ilk bastığımda hata veriyor arka planda word açılıyor (sadece görev yöneticide görünüyor)
eğer arka planda çalışan word'ü kapatmayıp
butona tekrar basarsam işlemi gerçekleştiriyor. sebebini ne olabilir?
Dim wdApp As Word.Application, wdDoc As Word.Document

On Error Resume Next
Set wdApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then 'Word isn't already running
Set wdApp = CreateObject("Word.Application")
End If
On Error GoTo 0
Set wdDoc = wdApp.Documents.Open("dosyayolu&adı")

wdApp.Visible = True

   With wdApp
       With wdDoc.Content.Find
           .Text = Me.TxtBul
           .Replacement.Text = Me.TxtDegis
           .Wrap = wdFindContinue
           .Execute Replace:=wdReplaceAll
       End With
'        .ActiveDocument.SaveAs2 FileName:=SaveAsName, FileFormat:=17
   End With

'You can now do whatever you like with the Word document e.g.

'wdDoc.PrintOut
wdDoc.SaveAs "dosyayolu&adı"



Cvp: Word'de Bul Ve Değiştir - ozanakkaya - 04/04/2019

İnceleyiniz. Kod içerisindeki tek tırnak ile iptal edilen kısımları aktif ederseniz, dizindeki tüm word dosyalarında değişiklik yapar.


Cvp: Word'de Bul Ve Değiştir - berduş - 04/04/2019

yardımlarınız için teşekkürler hocam. sorun çözüldü.
yalnız "content" ile "StoryRanges" arasındaki fark ne?
hangisi nerede kullanılmalı?