I had to use loop for applying masterpage on page range:
For i = myStartPage To myDoc.DocumentPreferences.PagesPerDocument
myDoc.Pages.Item(i).AppliedMaster = myDoc.MasterSpreads.Item(myShbl.Name)
I wonder, why this method doesn't work:
myDoc.Pages.ItemByRange(myStartPage, myEndPage).AppliedMaster = myDoc.MasterSpreads.Item("A-Master")
This works for me in JS, so it should work in VB as well:
var myDoc = app.activeDocument;
var myStartPage = myDoc.pages;
var myEndPage = myDoc.pages[-1];
myDoc.pages.itemByRange(myStartPage, myEndPage).appliedMaster = myDoc.masterSpreads.item("B-Master");
Have you defined myStartPage and myEndPage variables correctly?
Defining vars didn't help.
May be, that VB has limits for using "ItemByRange" method.
Yes, that is really so – for some reason the same code translated to VB doesn't work.