Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB Databases
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 1st, 2004, 09:59 PM
Authorized User
 
Join Date: Jun 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default BLOB graphic files /.wmf into a Word doc

Hi all,
Initally I wanted to take BLOB data from my Access database and put it into Word vis VB6. I can now get my BLOB file (which is really a .wmf file) extracted from my database and inserted into my word document. However, just as it gets inserted, my program detects a Type Mismatch error.

The word document is still available and active so I know the .wmf file was inserted properly. However it is 'floating' in my report and not contained in the bookmark I wanted it to be inserted into. And I still have the problem of my program crashing...heh

Any idea why this is all happening? Here is my code:


' I have this somewhere above in my code: On Error GoTo GenerateTemplate_errorhandler which gives me the "Type Mismatch" error msg

Dim MyVisioShape As Shape
Dim mstream As ADODB.Stream
Dim sFullPath As String

sFullPath = strDirectoryName & "\temp.wmf" '& rstMacroData.Fields("sFileExtension").Value
app.Selection.GoTo What:=wdGoToBookmark, Name:=conbkmXLDOC_VisioDrawing
app.Selection.HomeKey Unit:=wdLine

Set mstream = New ADODB.Stream
mstream.Type = adTypeBinary
mstream.Open
mstream.Write rstMacroData!Picture.Value
mstream.SaveToFile sFullPath, adSaveCreateOverWrite

Set MyVisioShape = app.ActiveDocument.Shapes.AddPicture(sFullPath, False, True, 0, 0, 143, 266) ' ' THIS IS THE LINE THAT IS PROCESSED BUT THEN DIES!


Please advise if you can. It says it's a Type Mismatch, but I know that it's a .wmf version of a Visio graphic.

Thanks,
Maria


 
Old July 2nd, 2004, 02:18 AM
Authorized User
 
Join Date: Aug 2003
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Did you try using an InlineShape?

.InlineShapes.AddPicture()

I also had some problems with shapes. Once in a while it said "Method or object not found" and with an inlineshape it always worked.

Hope it helps a bit.

Greetz

Tom.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Output Word WITH Template or Header Graphic Ron Howerton ASP.NET 2.0 Professional 1 October 31st, 2007 03:18 PM
how to finding the Graphic objects in word doc madhan_needs_help Word VBA 2 August 8th, 2007 10:38 AM
Copy text from 1 doc to other doc thru vba in word itchock Word VBA 2 December 29th, 2006 02:47 AM
Add BLOB graphic files into a Word Document mckly Pro VB Databases 0 June 30th, 2004 08:57 AM
How to generate WORD doc. from XML files??? iapraiz XML 1 March 11th, 2004 05:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.