J
justagrunt
Hi,
so far I have the following.
'check whether to create a new word instance or use an existing session
WordRunning = IsWordRunning
If WordRunning Then
Set WordApp = GetObject(, "Word.Application")
Else
Set WordApp = New Word.Application
End If
'open up the reference document
Set WordDoc = WordApp.Documents.Open("C:\Database\25KgPowder\Base.doc") '
With WordApp
.Visible = True
.WindowState = wdWindowStateNormal
End With
'check on the access form which controls are active
'open that section document
'copy it
'and then paste it after the book mark in the reference document
If (Me![Section11]) = True Then
'do something
Set WordDoc =
WordApp.Documents.Open("C:\Database\25KgPowder\Section11.doc")
'copy contents for pasting into original document
'???????????????????
'close the "Section11" document as not required anymore
'?????????????????????????????
'paste this section to the template
'bring original document to focus
'locate the bookmark and paste section11
Set WordDoc = WordApp.Documents.Open("C:\Database\25KgPowder\Base.doc")
Set WordDoc = WordApp.ActiveDocument
Set WordRng = WordDoc.GoTo(what:=wdGoToBookmark, NAME:="frmBookmark")
'paste
Else
'do something
End If
The if statements continue for another 10 conditions.
I am automating from access.
I open an existing document and if the access controls on the form are true,
add sections to the existing document.
How do I copy the second documents contents and add it to the original
document after the bookmark in the original document?
Then I want to close the second documnets session and move on tto add
another section if the next access control is true.
so far I have the following.
'check whether to create a new word instance or use an existing session
WordRunning = IsWordRunning
If WordRunning Then
Set WordApp = GetObject(, "Word.Application")
Else
Set WordApp = New Word.Application
End If
'open up the reference document
Set WordDoc = WordApp.Documents.Open("C:\Database\25KgPowder\Base.doc") '
With WordApp
.Visible = True
.WindowState = wdWindowStateNormal
End With
'check on the access form which controls are active
'open that section document
'copy it
'and then paste it after the book mark in the reference document
If (Me![Section11]) = True Then
'do something
Set WordDoc =
WordApp.Documents.Open("C:\Database\25KgPowder\Section11.doc")
'copy contents for pasting into original document
'???????????????????
'close the "Section11" document as not required anymore
'?????????????????????????????
'paste this section to the template
'bring original document to focus
'locate the bookmark and paste section11
Set WordDoc = WordApp.Documents.Open("C:\Database\25KgPowder\Base.doc")
Set WordDoc = WordApp.ActiveDocument
Set WordRng = WordDoc.GoTo(what:=wdGoToBookmark, NAME:="frmBookmark")
'paste
Else
'do something
End If
The if statements continue for another 10 conditions.
I am automating from access.
I open an existing document and if the access controls on the form are true,
add sections to the existing document.
How do I copy the second documents contents and add it to the original
document after the bookmark in the original document?
Then I want to close the second documnets session and move on tto add
another section if the next access control is true.