Вторник, 23 Декабря 2014 г. 17:01
+ в цитатник
Здравствуйте, выгружаю в шаблон ворд данные:
Dim objWord As Word.Application
' Turn hourglass on.
Screen.MousePointer = 11
' Resume to the next line following the error.
On Error Resume Next
' Attempt to reference Word which is already running.
Set objWord = GetObject(, "Word.Application")
' If true, Word is not running.
If objWord Is Nothing Then
' Create a new instance of the Word application.
Set objWord = New Word.Application
' If true, MS Word is not installed.
If objWord Is Nothing Then
MsgBox "MS Word is not installed on your computer"
End If
End If
objWord.Documents.Add (CurrentProject.Path & "\Doc\Sogl.dotm")
objWord.Visible = True
With objWord.Selection.Find
' .Text = "[номер]" ' Это название закладки, так она выглядит в тексте договора, сама закладка называется номер
' .Replacement.Text = "РК-114565" 'это на что ее нужно заменить
.Wrap = wdFindContinue
.Format = True
''false
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
objWord.Selection.Find.Execute Replace:=wdReplaceAll
Loop
' Move the cursor to the top of the document.
objWord.Selection.HomeKey Unit:=wdStory
DoEvents
' Turn hourglass off.
Screen.MousePointer = 0
' Activates Word
objWord.Activate
objWord.Visible = True
Set objWord = Nothing
Exit Sub
err00:
Debug.Print Err.Number, Err.Description
End Sub
Я еще не сталкивалась с выгрузкой данных в ворд с закладками. Помогите справиться
http://www.sql.ru/forum/1134107/eksport-v-shablon-word
-
Запись понравилась
-
0
Процитировали
-
0
Сохранили
-