Friday, 15 February 2013

VBA skips a For loop - why? -



VBA skips a For loop - why? -

i have vba code in ms word visual basic editor;

it meant reset page numbers work consecutively. however, seems skip entire contents of loop without executing this.

sub macro3() ' ' macro3 macro ' test 3 ' dim getnumberofpages incvar = 1 getnumberofpages wordbasic.viewfooteronly activedocument.attachedtemplate.buildingblockentries(" blank").insert _ where:=selection.range, richtext:=true wordbasic.viewfooteronly activedocument.attachedtemplate.buildingblockentries("plain number 3"). _ insert where:=selection.range, richtext:=true activewindow.activepane.view.seekview = wdseekmaindocument selection.wholestory selection.sections(incvar).headers(incvar).pagenumbers .numberstyle = wdpagenumberstylearabic .headinglevelforchapter = 0 .includechapternumber = false .chapterpageseparator = wdseparatorhyphen .restartnumberingatsection = false .startingnumber = 0 end selection.wholestory selection.escapekey activewindow.activepane.view.showall = not activewindow.activepane.view. _ showall selection.escapekey selection.escapekey next incvar end sub

why this? how can prepare it?

thanks,

barry smith

if utilize f8 step into... sequence , check value of getnumberofpages see getnumberofpages = empty , entire loop skipped

vba loops for-loop

No comments:

Post a Comment