COM Exception (code 0x800A03EC) thrown when programmatically changing page breaks in VB.Net -
i attempting use vb.net excel com interop programmatically change location of first horizontal page break on excel spreadsheet being generated program. code follows:
    dim range excel.range     xlactualws.activate()     xlactualws.pagesetup.printarea = "$a$1:$k$68"     range = xlactualws.range("a68", "a68")     xlactualws.hpagebreaks(1).location = range     system.runtime.interopservices.marshal.releasecomobject(range)   on line setting hpagebreaks, com exception code 0x800a03ec thrown, , can't find thing related searching. have idea i'm missing here?
based onthe code looks either location of page break cannot set or there 0 page breaks , hence you're accessing invalid index. quick way test out following
- check count property on 
xlactualws.hpagebreaks, see how many available - remove set of location property , see if error dissapears
 
additionally should remove releasecomobject call.  that's difficult api correct , clr quite @ cleaning com object references on it's own.  
Comments
Post a Comment