R
Ronny Sigo
Hello all,
I want to create a new word document from VBA (Access). All goes well,
except that I also want to establish a background programmatically. So I
made a macro in MS WORD, to see how it's done and then pasted the macrolines
in my code, but it does not work ... (those are the "ActiveDocument" lines
below ....)
Does anyone know how to do this ?
Thanks ...
Ronny
Private Sub btnEmailknop_Click()
' Hier begint Word
Dim appWD As Object
Dim myDoc As Object
Dim nHowmuchdown As Integer
Dim Spatie As Integer
Dim iLijn As Integer
Dim nAantallijnen As Integer
Set appWD = CreateObject("Word.Application")
appWD.Visible = True
With appWD
'.Resize Width:=768, Height:=552
Set myDoc = .Documents.Add
.WindowState = wdWindowStateMaximize
With .Selection
.ParagraphFormat.LeftIndent = 0
.PageSetup.LeftMargin = 80
.PageSetup.RightMargin = 52
.PageSetup.TopMargin = 127
.ParagraphFormat.LineSpacing = 13
.Font.Name = "Arial"
.Font.Size = 10
.insertafter Text:=sDatum & vbCr
End With
.Activate
For iLijn = 1 To 10
SendKeys "{UP}"
Next iLijn
'.WindowState = wdWindowStateMaximize
myDoc.ActiveWindow.ActivePane.VerticalPercentScrolled = 10
End With
ActiveDocument.Background.Fill.Visible = msoTrue
ActiveDocument.Background.Fill.ForeColor.RGB = RGB(255, 255,
255)
ActiveDocument.Background.Fill.Transparency = 0#
ActiveDocument.Background.Fill.UserPicture _
"K:\1. Management\1.7. ICT\1.7.3.
Applicaties\Taken\Beelden\logo_ZW_cbv.jpg"
End Sub
I want to create a new word document from VBA (Access). All goes well,
except that I also want to establish a background programmatically. So I
made a macro in MS WORD, to see how it's done and then pasted the macrolines
in my code, but it does not work ... (those are the "ActiveDocument" lines
below ....)
Does anyone know how to do this ?
Thanks ...
Ronny
Private Sub btnEmailknop_Click()
' Hier begint Word
Dim appWD As Object
Dim myDoc As Object
Dim nHowmuchdown As Integer
Dim Spatie As Integer
Dim iLijn As Integer
Dim nAantallijnen As Integer
Set appWD = CreateObject("Word.Application")
appWD.Visible = True
With appWD
'.Resize Width:=768, Height:=552
Set myDoc = .Documents.Add
.WindowState = wdWindowStateMaximize
With .Selection
.ParagraphFormat.LeftIndent = 0
.PageSetup.LeftMargin = 80
.PageSetup.RightMargin = 52
.PageSetup.TopMargin = 127
.ParagraphFormat.LineSpacing = 13
.Font.Name = "Arial"
.Font.Size = 10
.insertafter Text:=sDatum & vbCr
End With
.Activate
For iLijn = 1 To 10
SendKeys "{UP}"
Next iLijn
'.WindowState = wdWindowStateMaximize
myDoc.ActiveWindow.ActivePane.VerticalPercentScrolled = 10
End With
ActiveDocument.Background.Fill.Visible = msoTrue
ActiveDocument.Background.Fill.ForeColor.RGB = RGB(255, 255,
255)
ActiveDocument.Background.Fill.Transparency = 0#
ActiveDocument.Background.Fill.UserPicture _
"K:\1. Management\1.7. ICT\1.7.3.
Applicaties\Taken\Beelden\logo_ZW_cbv.jpg"
End Sub