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 programmaticall y. So I
made a macro is 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_Cl ick()
' 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("W ord.Application ")
appWD.Visible = True
With appWD
'.Resize Width:=768, Height:=552
Set myDoc = .Documents.Add
.WindowState = wdWindowStateMa ximize
With .Selection
.ParagraphForma t.LeftIndent = 0
.PageSetup.Left Margin = 80
.PageSetup.Righ tMargin = 52
.PageSetup.TopM argin = 127
.ParagraphForma t.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 = wdWindowStateMa ximize
myDoc.ActiveWin dow.ActivePane. VerticalPercent Scrolled = 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\Tak en\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 programmaticall y. So I
made a macro is 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_Cl ick()
' 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("W ord.Application ")
appWD.Visible = True
With appWD
'.Resize Width:=768, Height:=552
Set myDoc = .Documents.Add
.WindowState = wdWindowStateMa ximize
With .Selection
.ParagraphForma t.LeftIndent = 0
.PageSetup.Left Margin = 80
.PageSetup.Righ tMargin = 52
.PageSetup.TopM argin = 127
.ParagraphForma t.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 = wdWindowStateMa ximize
myDoc.ActiveWin dow.ActivePane. VerticalPercent Scrolled = 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\Tak en\Beelden\logo _ZW_cbv.jpg"
End Sub
Comment