On calls to Range.InlineShapes.Add("C:\blah.jpg") and Range.Shapes.Add("C:\blah.jpg") I kept getting a very helpful, precise error:
The server threw an exception.
(Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))
Thanks for that!
After playing around with the code for awhile, I found that my particular problem was being caused by how I instantiated the Word.Document object. My code read:
Dim mobjWordApp As New Word.Application()
mobjWordApp.Visible = False
Dim objDocSet As Word.Documents = mobjWordApp.Documents
Dim objDoc As Word.Document = objDocSet.Add(Visible:=MsoTriState.msoFalse)
Removing the Visible parameter from the Documents.Add() call fixed the error. It was unnecessary anyway, since I had already set Application.Visible to False.
Showing posts with label AddPicture. Show all posts
Showing posts with label AddPicture. Show all posts
Friday, July 13, 2007
Subscribe to:
Posts (Atom)