vb.net save in Word 2010 -


platform: windows , microsoft visual basic 2010 express

the problem: have word template made in word 2007. when application run in machine word 2010, saveas-command doesn't work. works fine open template , add data , photo bookmarks in template.

here statement doesn't work(vpath contains path , filename.):

odoc.saveas(vpath.tostring) 

i have tried different solution nothing works:

odoc.saveas(vpath.tostring, wdsaveformat.wdformatdocument) odoc.saveas(vpath.tostring, 17)  ' wdsaveformat.wdformatpdf odoc.saveas(vpath.tostring, 6)   ' wdsaveformat.wdformatrtf 

references:

  • microsoft office 12.0 object library
  • microsoft word 12.0 object library

import statements:

imports microsoft.office.interop imports microsoft.office.interop.word 

i using office 14 , downloaded 2007 template. following code works me.

imports microsoft.office.interop .... dim objapp word.application dim objdoc word.document objapp = new word.application() objdoc = objapp.documents.open("c:\delme\templateoriginal.dotx") objdoc.activate() objapp.selection.typetext("some text") objdoc.saveas("c:\delme\template.dotx") objdoc.close() objapp.quit() objdoc = nothing objapp = nothing 

did check vpath correct? not sure vpath is, tostring method right missing parenthesis chance?

vpath.tostring -> vpath.tosring() 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -