Skip to main content

AccessTr.neT


Excel Vba İle Word Belgesi Ve Yolunu Kaydetme

Excel Vba İle Word Belgesi Ve Yolunu Kaydetme

#7
aşağıdaki dosyayı dener misiniz?
1 - dosyanızın makroları çalıştırabilmesi için dosyanızın makroları destekleyen formatta (xlsm, xlsb gibi) olması gerek
2 - referanslardan Microsoft Word xx.x Object Library eklenmeli
Word belgesi seçme kodu
Sub WordAd()
t1 = Timer
Application.ScreenUpdating = False
Set sht = ThisWorkbook.Worksheets("WordXL")
      i = sht.Cells(sht.Rows.Count, "A").End(xlUp).Row + 1
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
    .AllowMultiSelect = True
    .Title = "Word belgelerini seçiniz"
    .InitialFileName = ThisWorkbook.Path
    'Optional: Add filters
    .Filters.Clear
    .Filters.Add "Word Belgeleri", "*.doc,*.docx"
    .Filters.Add "Tüm Dosyalar", "*.*"

If .Show = -1 Then
DsSay = 0
    For Each xWord In .SelectedItems
      Word2Text xWord, i
      i = i + 1
      DsSay = DsSay + 1
    Next xWord
End If
End With
Application.ScreenUpdating = True
  MsgBox "Aktarım Tamam! " & vbNewLine & "Süre : " & (Timer - t1) & " saniye " & vbNewLine & "Aktarılan Dosya sayısı : " & DsSay
End Sub
excele aktarma kodu
Public Sub Word2Text(ByVal xFilePath As String, ByVal xSatir As Long)  'Word2Text "d:\Desktop\Word2Excel\19 - Vba Class Modules.docx"

  Dim x As Document
  Set x = Documents.Open(xFilePath, ReadOnly:=True, Visible:=False)
  Dim data
  Set data = x.Content
  ' do something with the content or the document
  xStr = data
  Sayfa1.Cells(xSatir, 1) = xStr
  Sayfa1.Cells(xSatir, 2) = xFilePath
  'close the document
  x.Close
  Set x = Nothing

End Sub
.rar Word_VeriAl_hy3.rar (Dosya Boyutu: 18,63 KB | İndirme Sayısı: 3)
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Bu Konudaki Yorumlar
RE: Excel Vba İle Word Belgesi Ve Yolunu Kaydetme - Yazar: berduş - 26/02/2022, 11:58
Task