PasteSpecial into Word
-
I am trying to copy a metafile into a Word document, and then set its location on the page. It pastes it alright, but I get an error that the "object is not valid" when I try to change the location. I think I am not properly getting ahold of the shape that has been pasted, but I do not know where the problem is. Here is the code: object oEnd = "\\endofdoc"; oRange = oDoc.Bookmarks.Item(ref oEnd).Range; object pasteDataType = Word.WdPasteDataType.wdPasteMetafilePicture; oRange.PasteSpecial(ref oMissing,ref oFalse,ref oMissing, ref oFalse, ref pasteDataType, ref oMissing, ref oMissing); oRange = oWord.Selection.Range; oShapeRange = oRange.ShapeRange; oShapeRange.Left = xLoc; oShapeRange.Top = yLoc; oShapeRange.Width = xSize; oShapeRange.Height = ySize;