Excel to input fields into a Word Form

A

ArmsteR

Good afternoon all,

I have an excel problem I could do with some direction with.

Basically This is a work in progress but once this one piece is sorted
I can manipulate it to replicate down....

We have an excel spreadsheet that has information such as site name,
site code, etc etc etc. the corresponding value for these we need
adding to a MS Word template, then saving and the saved location copied
back into excel...

The bit I can't do at the moment is how do you take the information
from excel into word? the code below is the initial setup i have to do
this but can't think of how to start the import bit...

The word form text fields have bookmarks called Author, sitetext,
reftext etc which are located in cells A1, B1 and C1 respectively or
workbook "EntryForm"


Code:
Sub Word1()
'
' WORD1 Macro
' Opens an instance of MS Word and then opens the document Below to be
confirgured
'
ActiveWindow.Visible = False
Windows("Form test.xls").Activate
Set WordApp = CreateObject("Word.Application")
WordApp.Visible = True
WordApp.Documents.Open "E:\Marks form control\ch23\siteform.doc"


' After document is open the next stage is to perform your alterations






Set WordDoc = Nothing
Set WordApp = Nothing

End Sub




any helps or pointers would be appreciated
 
A

ArmsteR

ArmsteR;534199 said:
Good afternoon all,

I have an excel problem I could do with some direction with.

Basically This is a work in progress but once this one piece is sorted
I can manipulate it to replicate down....

We have an excel spreadsheet that has information such as site name,
site code, etc etc etc. the corresponding value for these we need
adding to a MS Word template, then saving and the saved location copied
back into excel...

The bit I can't do at the moment is how do you take the information
from excel into word? the code below is the initial setup i have to do
this but can't think of how to start the import bit...

The word form text fields have bookmarks called Author, sitetext,
reftext etc which are located in cells A1, B1 and C1 respectively or
workbook "EntryForm"


Code:
Sub Word1()
'
' WORD1 Macro
' Opens an instance of MS Word and then opens the document Below to be
confirgured
'
ActiveWindow.Visible = False
Windows("Form test.xls").Activate
Set WordApp = CreateObject("Word.Application")
WordApp.Visible = True
WordApp.Documents.Open "E:\Marks form control\ch23\siteform.doc"


' After document is open the next stage is to perform your alterations






Set WordDoc = Nothing
Set WordApp = Nothing

End Sub




any helps or pointers would be appreciated






Ok here is what i've got now





Code:
--------------------

Sub Word1()

Dim WordApp As Object
Dim SaveAsName As String

' Opens an instance of MS Word and then opens the document Below to be confirgured
'

Sheets("EntryForm").Select
Range("B1").Select
Selection.Copy


ActiveWindow.Visible = False
Windows("Form test.xls").Activate
Set WordApp = CreateObject("Word.Application")
WordApp.Visible = True
WordApp.Documents.Open "E:\Marks form control\siteform.doc"
WordApp.Selection.PasteSpecial Link:=False, Placement:=Bookmarks("Sitetext"), DisplayAsIcon:=False
' WordApp.ActiveDocument.Bookmarks("Sitetext").Range



Set WordDoc = Nothing
Set WordApp = Nothing

End Sub
 
Top