Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pasting gif files to Word

Status
Not open for further replies.

Madiba1

Programmer
Apr 18, 2006
15
A2
Hi,

I am writing an application that reads some gif files and would like them to be pasted in ms-word file.

Any pointers will be highly appreciated.

Madiba
 
What do you mean, "reads some gif files"? Do you just mean it looks for files of that type with other certain critieria, and then pastes them into a Word Doc?
 
Sorry for the vagueness of my post. I mean, I have file like: pics.gif and pic2.gif. I want this files to be inserted in a word file. I used the code below but the pictures are pasted on top of each other and can only open the file with word prior to 97.


Set objWord = CreateObject("Word.Application")
strTemplateFile = "C:\Template.doc"
Set objWordDoc = objWord.Documents.Add

With objWordDoc
.Content.InsertBefore "Expenditure" & vbCrLf & vbCrLf
.Shapes.AddPicture "C:\funding_4.gif", True, True
.Paragraphs(1).Alignment = WD_ALIGN_PARAGRAPH_RIGHT
.Content.InsertBefore "Balance Brought Forward " & vbCrLf & vbCrLf
.Content.InsertBefore vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf
.Shapes.AddPicture "C:\funding_3.gif", True, True
.Content.InsertBefore "Funds Allocated" & vbCrLf & vbCrLf
.Shapes.AddPicture "C:\funding_2.gif", True, True
.Paragraphs(1).Alignment = WD_ALIGN_PARAGRAPH_RIGHT
.Content.InsertBefore "Funds Requested" & vbCrLf & vbCrLf
.Content.InsertBefore vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf
.Shapes.AddPicture "C:\funding_1.gif", True, True
.SaveAs FileName:=strCurrentPath & "arv.doc"
.SaveAs FileName:="c:\DMSAC.doc"
.Close (WD_DONOTSAVECHANGES)
End With

Madiba
 
Have you tried Carriage Return as apposed to Line Feed, and see if that works better for your specific instance?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top