01-03-2019, 23:38
Merhaba, daha önce üstatların yardımıyla Access formdan Word belgesine alanlar aktararak dosyayı aşağıdaki kodlarla Access uygulamasının bulunduğu klasöre kayıt yapıyordum.
If MsgBox("D İ K K A T, BELGE Görüntülenecek. Onaylıyor musunuz?", vbInformation + vbOKCancel, "BİR DOST") = vbOK Then
Else
Exit Sub
End If
Dim WordApp As Word.Application
Dim strTemplateLocation As String
strTemplateLocation = CurrentProject.Path & "\Belge Şablonları\Belge.dot"
On Error Resume Next
Set WordApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set WordApp = CreateObject("Word.Application")
End If
On Error GoTo ErrHandler
WordApp.Visible = True
WordApp.WindowState = wdWindowStateMaximize
WordApp.Documents.Add Template:=strTemplateLocation, NewTemplate:=False
With WordApp.Selection
WordApp.ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Dim Sw As Long
For Sw = 0 To 1
With WordApp.ActiveDocument.Bookmarks("tarih" & IIf(Sw = 0, Null, Sw)).Range
.GoTo What:=wdGoToBookmark, Name:="tarih"
.Text = IIf(IsNull(Tarih), "", [Tarih])
End With
Next Sw
DoEvents
WordApp.ActiveDocument.SaveAs FileName:=CurrentProject.Path & "\Belge" & Format(Date, "dd mmmm yyyy") & "_" & Format(Time, "hh mm") & ".doc", FileFormat:=wdFormatdoc
WordApp.Activate
Set WordApp = Nothing
Exit Sub
ErrHandler:
Resume Next
End With
Şimdi ise yapmak istediğim
Dim fold As Object
Set fold = CreateObject("Shell.Application"). _
BrowseForFolder(0, "Klasör seçiniz...", 0)
Kodlarını yukarıda bulunan kodlarla birleştirmek ve oluşturduğum Word belgesinin kayıt yerini seçebilmek. Ne yapmalıyım.
If MsgBox("D İ K K A T, BELGE Görüntülenecek. Onaylıyor musunuz?", vbInformation + vbOKCancel, "BİR DOST") = vbOK Then
Else
Exit Sub
End If
Dim WordApp As Word.Application
Dim strTemplateLocation As String
strTemplateLocation = CurrentProject.Path & "\Belge Şablonları\Belge.dot"
On Error Resume Next
Set WordApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set WordApp = CreateObject("Word.Application")
End If
On Error GoTo ErrHandler
WordApp.Visible = True
WordApp.WindowState = wdWindowStateMaximize
WordApp.Documents.Add Template:=strTemplateLocation, NewTemplate:=False
With WordApp.Selection
WordApp.ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Dim Sw As Long
For Sw = 0 To 1
With WordApp.ActiveDocument.Bookmarks("tarih" & IIf(Sw = 0, Null, Sw)).Range
.GoTo What:=wdGoToBookmark, Name:="tarih"
.Text = IIf(IsNull(Tarih), "", [Tarih])
End With
Next Sw
DoEvents
WordApp.ActiveDocument.SaveAs FileName:=CurrentProject.Path & "\Belge" & Format(Date, "dd mmmm yyyy") & "_" & Format(Time, "hh mm") & ".doc", FileFormat:=wdFormatdoc
WordApp.Activate
Set WordApp = Nothing
Exit Sub
ErrHandler:
Resume Next
End With
Şimdi ise yapmak istediğim
Dim fold As Object
Set fold = CreateObject("Shell.Application"). _
BrowseForFolder(0, "Klasör seçiniz...", 0)
Kodlarını yukarıda bulunan kodlarla birleştirmek ve oluşturduğum Word belgesinin kayıt yerini seçebilmek. Ne yapmalıyım.

