ник: Егор
Private Sub butNewWord()
Dim app As Word.Application
Dim strDoc As String
Dim strDOT As String
Dim S As String
Dim i As String
On Error GoTo 999
i = Me.pole41.Value
Select Case i
Case "USD"
With Application.CurrentProject
strDOT = .Path & "\" & "USD\USD.dot"
strDoc = .Path & "\" & "USD\USD.doc"
End With
Case "UAH"
With Application.CurrentProject
strDOT = .Path & "\" & "UAH\UA.dot"
strDoc = .Path & "\" & "UAH\UA.doc"
End With
End Select
Set app = New Word.Application
app.Documents.Add strDOT
app.Visible = True
app.CommandBars("Menu Bar").Enabled = False
app.CommandBars("Standard").Enabled = False
app.CommandBars("Formatting").Enabled = False
app.CommandBars("Visual Basic").Enabled = False
app.CommandBars("WordArt").Enabled = False
app.CommandBars("AutoText").Enabled = False
app.CommandBars("Database").Enabled = False
app.CommandBars("Web Tools").Enabled = False
app.CommandBars("Web").Enabled = False
app.CommandBars("Picture").Enabled = False
app.CommandBars("Frames").Enabled = False
app.CommandBars("Reviewing").Enabled = False
app.CommandBars("Drawing").Enabled = False
app.CommandBars("Mail Merge").Enabled = False
app.CommandBars("Word Count").Enabled = False
app.CommandBars("Outlining").Enabled = False
app.CommandBars("Tables and Borders").Enabled = False
app.CommandBars("Forms").Enabled = False
app.CommandBars("E-mail").Enabled = False
app.CommandBars("Control Toolbox").Enabled = False
app.CommandBars("Function Key Display").Enabled = False
With app.ActiveDocument
On Error Resume Next
.Bookmarks.Item("versiya").Range.Text = Me.pole64
.Bookmarks.Item("nomer").Range.Text = Me.pole33
.Bookmarks.Item("famname").Range.Text = Me.pole7 & " " & Me.pole9 & " " & Me.pole11
.Bookmarks.Item("datazakl").Range.Text = Me.pole35
.Bookmarks.Item("datar").Range.Text = Me.pole15
.Bookmarks.Item("mesto").Range.Text = Me.pole13
.Bookmarks.Item("sernompas").Range.Text = Me.pole17
.Bookmarks.Item("datapas").Range.Text = Me.pole19
.Bookmarks.Item("vidanpas").Range.Text = Me.pole21
.Bookmarks.Item("ident").Range.Text = Me.pole5
.Bookmarks.Item("nomkr").Range.Text = Me.pole23
.Bookmarks.Item("datazkr").Range.Text = Me.pole25
.Bookmarks.Item("sum").Range.Text = Me.pole39
.Bookmarks.Item("tarif").Range.Text = Me.pole49
.Bookmarks.Item("premiya").Range.Text = Me.pole51
.Bookmarks.Item("granica").Range.Text = Me.pole53
.Bookmarks.Item("dataok").Range.Text = Me.pole37
Err.Clear
.Protect wdAllowOnlyReading, False, "dsitk,feirb", False, True
.SaveAs strDoc
makros
'***************************
.PrintOut True, False, wdPrintAllDocument, "", , , wdPrintDocumentContent, 1, "", wdPrintAllPages, False, True, , True, 0, 0, 0, 0
On Error GoTo 999
End With
Exit Sub
999:
MsgBox Err.Description
Err.Clear
Set app = Nothing
app.Quit
End Sub