Word |
Private Sub _Click() Dim Name As String Name = Me._ ' , strPathDot = Application.CurrentProject.Path & "\(Access).dot" ' strPathWord = CurrentProject.Path & "\" & Forms![]!_ & ".doc" Call funOutputWord(strPathDot, strPathWord) End Sub ' Word Function funOutputWord(strPathDot As String, strPathWord As String) As Boolean On Error GoTo Err_ Dim DlgUser As Integer, i As Long ' If Dir(strPathWord) <> "" Then ' strPathWord ( ) DlgUser = MsgBox(" . ?", vbYesNo, "admin") If DlgUser = vbNo Then ' - Set app = CreateObject("Word.Application") ' Word, With app .Visible = True ' Word .Documents.Open strPathWord ' ( strPathWord) End With Set app = Nothing ' Else ' - GoTo nn ' nn End If Else ' strPathWord nn: Set app = New Word.Application ' Word app.Visible = True ' Word app.Documents.Add strPathDot ' Word With app.ActiveDocument ' - ' .Bookmarks.Item("_").Range.Text = Nz(_, "") .Bookmarks.Item("_").Range.Text = Nz(_, "") .Bookmarks.Item("").Range.Text = Nz(, "") strPathWord = CurrentProject.Path & "\" & Forms![]!_ & ".doc" .SaveAs (strPathWord) ' strPathWord End With Set app = Nothing ' End If funOutputWord = True ' Exit_: Exit Function Err_: funOutputWord = False Err.Clear app.Quit Resume Exit_ End Function
http://www.sql.ru/forum/1116759/sohranenie-dannyh-v-fayl-word-pod-zadannym-po-znacheniu-polya-imenem