• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

[CS3-VB] Why doesn't applying masterpage on page range?

New Here ,
Jun 17, 2009 Jun 17, 2009

Copy link to clipboard

Copied

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)
Next 'i

I wonder, why this method doesn't work:

myDoc.Pages.ItemByRange(myStartPage, myEndPage).AppliedMaster = myDoc.MasterSpreads.Item("A-Master")

TOPICS
Scripting

Views

626

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jun 17, 2009 Jun 17, 2009

Copy link to clipboard

Copied

This works for me in JS, so it should work in VB as well:

var myDoc = app.activeDocument;
var myStartPage = myDoc.pages[0];
var myEndPage = myDoc.pages[-1];
myDoc.pages.itemByRange(myStartPage, myEndPage).appliedMaster = myDoc.masterSpreads.item("B-Master");

Have you defined myStartPage and myEndPage variables correctly?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 17, 2009 Jun 17, 2009

Copy link to clipboard

Copied

Defining vars didn't help.

May be, that VB has limits for using "ItemByRange" method.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jun 17, 2009 Jun 17, 2009

Copy link to clipboard

Copied

LATEST

Yes, that is really so – for some reason the same code translated to VB doesn't work.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines