ник: ???????
Re: Проблема с отчетом в ворде Private Sub Кнопка191_Click()
Dim sPath As String
Dim sFileName As String
Dim wApp, wDocShabl, wDoc, myRange As Object
Dim i, j As Integer
On Error GoTo Кнопка191_ClickErr
Set wApp = CreateObject("word.Application")
wApp.Visible = True
sPath = CurrentDb.Name
i = InStrRev(sPath, "", , vbTextCompare)
If i > 0 Then
sPath = Left(sPath, i)
sFileName = sPath & "отчет.dot"
Else
sFileName = ""
End If
Set wDoc = wApp.Documents.Add(Template:=sFileName, _
NewTemplate:=False, _
DocumentType:=0)
wApp.Selection.Find.ClearFormatting
wApp.Selection.Find.Replacement.ClearFormatting
With wApp.Selection.Find
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
wApp.Selection.Find.Text = "[#blok15]"
wApp.Selection.Find.Replacement.Text = Nz(Me.ЗначениеПоляМеmo, "")
wApp.Selection.Find.Execute Replace:=2
End Sub