Dave_C
04-08-2008, 03:59 AM
Hi all,
Task: Take data from an Excel sheet and place in to a Word document.
You guys may think otherwise and if you do please put me right but the best way i've found so far is to use some code from Excel VBA Programming for Dummies (that's me btw :hi: ) make memos.xls.
This is the code to make the Word doc' Send commands to Word
With WordApp
.Documents.Add
With .Selection
.Font.Size = 14
.Font.Bold = True
.ParagraphFormat.Alignment = 1
.TypeText Text:="M E M O R A N D U M"
.TypeParagraph
.TypeParagraph
.Font.Size = 12
.ParagraphFormat.Alignment = 0
.Font.Bold = False
.TypeText Text:="Date:" & vbTab & _
Format(Date, "mmmm d, yyyy")
.TypeParagraph
.TypeText Text:="To:" & vbTab & Region & " Manager"
.TypeParagraph
.TypeText Text:="From:" & vbTab & _
Application.UserName
.TypeParagraph
.TypeParagraph
.TypeText message
.TypeParagraph
.TypeParagraph
.TypeText Text:="Units Sold:" & vbTab & SalesNum
.TypeParagraph
.TypeText Text:="Amount:" & vbTab & _
Format(SalesAmt, "$#,##0")
End With
.ActiveDocument.SaveAs FileName:=SaveAsName
End With
I think i can adapt this code for my needs ok but have one small problem. I would like to store a gif image in the xls file and pass that to the word doc to. How do i do that? Or am i going in completely the wrong direction?
Task: Take data from an Excel sheet and place in to a Word document.
You guys may think otherwise and if you do please put me right but the best way i've found so far is to use some code from Excel VBA Programming for Dummies (that's me btw :hi: ) make memos.xls.
This is the code to make the Word doc' Send commands to Word
With WordApp
.Documents.Add
With .Selection
.Font.Size = 14
.Font.Bold = True
.ParagraphFormat.Alignment = 1
.TypeText Text:="M E M O R A N D U M"
.TypeParagraph
.TypeParagraph
.Font.Size = 12
.ParagraphFormat.Alignment = 0
.Font.Bold = False
.TypeText Text:="Date:" & vbTab & _
Format(Date, "mmmm d, yyyy")
.TypeParagraph
.TypeText Text:="To:" & vbTab & Region & " Manager"
.TypeParagraph
.TypeText Text:="From:" & vbTab & _
Application.UserName
.TypeParagraph
.TypeParagraph
.TypeText message
.TypeParagraph
.TypeParagraph
.TypeText Text:="Units Sold:" & vbTab & SalesNum
.TypeParagraph
.TypeText Text:="Amount:" & vbTab & _
Format(SalesAmt, "$#,##0")
End With
.ActiveDocument.SaveAs FileName:=SaveAsName
End With
I think i can adapt this code for my needs ok but have one small problem. I would like to store a gif image in the xls file and pass that to the word doc to. How do i do that? Or am i going in completely the wrong direction?