c# - Office Interop Exception running Interop v15 on Windows XP -


i running .exe pass argument to, using office.interop v15. works fine on dev machine windows 7 office 2013. when move vm running windows xp , office 2010, run time error stating

system.runtime.interopservices.comexception (0x80020005): type mismatch. (exception hresult: 0x80020005 (disp_e_typemismatch))

is because interop v15 doesn't support lower version of office?

snippet error occurs

doc = app.documents.open(filetoprint) /happens here doc.printout(false) doc.close() app.quit() 

oddly enough runs has runtime error.

try this.

replace code:

doc = app.documents.open(filetoprint) /happens here 

with (in vb.net)

dim s_missing object = system.reflection.missing.value doc = app.documents.open (filetoprint, s_missing, s_missing, s_missing, s_missing,s_missing, s_missing, s_missing, s_missing, s_missing, s_missing, s_missing, s_missing, s_missing, s_missing, s_missing) 

or (in c#)

static object s_missing = system.reflection.missing.value; doc = app.documents.open ( ref filetoprint,    ref s_missing,    ref s_missing,    ref s_missing,    ref s_missing,    ref s_missing,    ref s_missing,    ref s_missing,    ref s_missing,    ref s_missing,    ref s_missing,    ref s_missing,    ref s_missing,    ref s_missing,    ref s_missing,    ref s_missing ); 

Popular posts from this blog