word 2003 VBA code not working in word 2007 -


friends, trying disable display alerts while using printout command. code isn't working runtime error like'read only', 'word converter','invalid reference type'. suppress errors. code below confirm how code same word in 2007, works okay in word 2003.

    if optcentral.value = false         set oprint = getobject(lbxresults.list(varloop))     end if end if  if optcentral.value = true     'do nothing, copied elseif optptrover.value = true     oprint         'store existing print settings         bvaluestoreufap = .application.options.updatefieldsatprint         bvaluestoreulap = .application.options.updatelinksatprint         bvaluestoredisplayallerts = .application.displayalerts          'change print settings, stops unwanted pop-up boxes         .application.options.updatefieldsatprint = false         .application.options.updatelinksatprint = false         .application.displayalerts = wdalertsnone          'print document         .printout copies:=varcopies          'restore original print settings         .application.options.updatefieldsatprint = bvaluestoreufap         .application.options.updatelinksatprint = bvaluestoreulap         .application.displayalerts = bvaluestoredisplayallerts          .saved = true         .close 

at beginning of vba code block (sub or function), make first line this:

on error resume next 

this may allow want.

it poor practice, in general. sloppy , dangerous fix. vba provides tools error-handling, , apply those. consequences of suppressed error reporting big.

that said, using resume next instruction fine initial trouble shooting. depending entirely on situation, may adequate solution.

if still receive error, dealing issue in word document or file structure. think that's likely. in case, you'll big step forward in solving problem. don't forget remove resume next instruction.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -