Вставка изображений в документ Word |
Option Compare Database Option Explicit Private Sub button_Click() Dim app As Word.Application Dim strDOC, strDOT, strPodp1 As String Dim strPodp2 As String Dim ctl As Control Dim s As String On Error GoTo 999 With Application.CurrentProject strDOT = .path & "\" & "vipiska.doc" strDOC = .path & "\" & "vip11.doc" strPodp1 = .path & "\" & "Podp1.png" strPodp2 = .path & "\" & "Podp2.png" End With Set app = New Word.Application app.Visible = True app.Documents.Add strDOT With app.ActiveDocument On Error Resume Next For Each ctl In Me.Controls If ctl.ControlType = acTextBox Then s = ctl.Name .Bookmarks.Item(s).Range.Text = Me(s) Err.Clear End If Next ctl .SaveAs strDOC On Error GoTo 999 End With Call Procedure1(20, strPodp1) Call Procedure1(20, strPodp2) app.Quit Set app = Nothing Exit Sub 999: MsgBox Err.Description Err.Clear app.Quit Set app = Nothing End Sub Sub Procedure1(dTop As Double, sName As String) Dim oShape As Word.Shape Set oShape = ActiveDocument.Shapes.AddPicture(sName, False, True, 10, 10) With oShape .LockAspectRatio = msoTrue '.Height = 500 .Width = 50 .RelativeHorizontalPosition = wdRelativeHorizontalPositionPage .RelativeVerticalPosition = wdRelativeVerticalPositionPage .LayoutInCell = False .WrapFormat.AllowOverlap = True .Left = CentimetersToPoints(7.5) .Top = CentimetersToPoints(dTop) End With Set oShape = Nothing End Sub
http://www.sql.ru/forum/1153798/vstavka-izobrazheniy-v-dokument-word
Комментировать | « Пред. запись — К дневнику — След. запись » | Страницы: [1] [Новые] |