D
damezumari
I use vb6, win2000, word2003.
I would like to create a word document with two lines:
Line1: image Elvis
Line2: image Presley
"image" is an image.
The code below only generates this:
Line1: Presley
---
Private Sub Command1_Click()
'project reference: Microsoft Word Object Library
Dim WordApp As Word.Application
Dim WordDoc As Word.Document
Dim WordPara As Word.Paragraph
Dim r As Range
Set WordApp = CreateObject("Word.Application")
Set WordDoc = WordApp.Documents.Add
Set WordPara = WordDoc.Content.Paragraphs.Add
Set r = WordPara.Range
WordDoc.InlineShapes.AddPicture _
FileName:="C:\Inetpub\wwwroot\explorerview\folder.gif", _
LinkToFile:=False, _
SaveWithDocument:=True, _
Range:=r
r.Text = "Elvis" + Chr(13)
WordDoc.InlineShapes.AddPicture _
FileName:="C:\Inetpub\wwwroot\explorerview\folder.gif", _
LinkToFile:=False, _
SaveWithDocument:=True, _
Range:=r
r.Text = "Presley" + Chr(13)
WordDoc.Activate
WordApp.Visible = True
MsgBox "fin"
End Sub
---
What am I doing wrong?
Regards,
Jan Nordgreen
I would like to create a word document with two lines:
Line1: image Elvis
Line2: image Presley
"image" is an image.
The code below only generates this:
Line1: Presley
---
Private Sub Command1_Click()
'project reference: Microsoft Word Object Library
Dim WordApp As Word.Application
Dim WordDoc As Word.Document
Dim WordPara As Word.Paragraph
Dim r As Range
Set WordApp = CreateObject("Word.Application")
Set WordDoc = WordApp.Documents.Add
Set WordPara = WordDoc.Content.Paragraphs.Add
Set r = WordPara.Range
WordDoc.InlineShapes.AddPicture _
FileName:="C:\Inetpub\wwwroot\explorerview\folder.gif", _
LinkToFile:=False, _
SaveWithDocument:=True, _
Range:=r
r.Text = "Elvis" + Chr(13)
WordDoc.InlineShapes.AddPicture _
FileName:="C:\Inetpub\wwwroot\explorerview\folder.gif", _
LinkToFile:=False, _
SaveWithDocument:=True, _
Range:=r
r.Text = "Presley" + Chr(13)
WordDoc.Activate
WordApp.Visible = True
MsgBox "fin"
End Sub
---
What am I doing wrong?
Regards,
Jan Nordgreen