View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] aidan.heritage@virgin.net is offline
external usenet poster
 
Posts: 244
Default Export cell data to a template in Word

On 3 Aug, 08:58, mike wrote:
Good Morning All,

I have worked with macros in Excel before and with the help of this
discussion board managed to make some very complicated stuff work.

Now, I have a different problem...

I have data in an Excel sheet and based on that data I must compile a report
in Word.

The sheet is structured as follows:

Criteria - Company A - Company B - Company C

Info 1
Info 2
Info 3

Is it possible to create a macro to take information from each criteria and
each company and export that information to a template in Word (Basically
filling in the blanks). If it is possible, where should I begin?

Thanks,

Mike


Yes, no problem at all - something like



Dim appwd As Object
On Error GoTo notloaded
Set appwd = GetObject(, "Word.Application")
notloaded:
If Err.Number = 429 Then
Set appwd = CreateObject("Word.Application")
End If
appwd.Visible = True
On Error GoTo 0
With appwd
.documents.Add Template:="Path and Name of Template"
'now fill out the document
appwd.activedocument.bookmarks("Whatever").Range.T ext =
Range("Wherever").Value

end with
set appwd=nothing