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
|