Some new information....
I running Word Version 10. SP3 according to the Word help
I've created a new VB6 project to try to isolate the problem.
I have a project references in VB6 to both Microsoft Word 10 Object
Library and Microsoft Office 10 Object library
Here is the complete code I'm running in VB6 (As I stated above, the
same code works fine when run in the Word 2002 excluding the part to
get Word going.)
Private Sub Command2_Click()
Dim MyRange As Range
Dim myShape As Shape
Dim obj As Object
On Error Resume Next
Set obj = _
CreateObject("Word.Application")
On Error GoTo 0
obj.Documents.Add 'create a new document
obj.Selection.InsertAfter "This is some text"
' Set MyRange = Selection.Sections.Last _
.Headers(wdHeaderFooterPrimary).Range
Set MyRange = ActiveDocument.Paragraphs.Last.Range
MyRange.Collapse wdCollapseEnd
Set myShape = ActiveDocument.Shapes.AddPicture _
(FileName:="C:\ELLIOT\AddressBook\Versals\Wetstein\A.gif", _
linktofile:=False, savewithdocument:=True, _
Anchor:=MyRange)
With myShape
.WrapFormat.Type = wdWrapNone
.Height = 60
.Width = 80
.LockAspectRatio = msoTrue
.RelativeHorizontalPosition = _
wdRelativeHorizontalPositionPage
.RelativeVerticalPosition = _
wdRelativeVerticalPositionPage
.Left = InchesToPoints(1#)
.Top = InchesToPoints(1.25)
End With
obj.Quit 'close Word
Set obj = Nothing
End Sub
When I run the code, it stops on the following line:
.WrapFormat.Type = wdWrapNone
with the message::
Compile error:
Method or Data Member not Found.
If I comment out the WrapFormatType line, the same error occurrs on
most of the remaining properites.
If I comment them all out, I get a runtime error 13 Type MisMatch on
the following line:
Set myShape = ActiveDocument.Shapes.AddPicture _
(FileName:="C:\ELLIOT\AddressBook\Versals\Wetstein\A.gif", _
linktofile:=False, savewithdocument:=True, _
Anchor:=MyRange)
That's it. Hope someone can help.
Thanks again
Elliot
Jonathan West - 02 Nov 2005 12:56 GMT
Hi Elliot,
Your problem is in fact in this line
Dim myShape As Shape
This is because VB6 has its own Shape object. The order of references in the
project references list defines which library's Shape object is used by
default when two different libraries have objects with the same name. VB6's
own libraries are listed above Word's libraries.
To force the use of Word's Shape object, change the declaration to this,
explicitly forcing the use of the Word library
Dim myShape As Word.Shape
All should then be well.

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
> Some new information....
>
[quoted text clipped - 67 lines]
> Thanks again
> Elliot
eselick@gmail.com - 15 Nov 2005 22:38 GMT
I really appreciate the help.
Thanks