The ActiveBook is an exact analog of the ActiveDoc. It refers to the book that has the user focus.
There can be an active book or an active document but not both at the same time. It is also possible that there is neither an active book nor an active document.
When working with either an active book or an active document, you should check for the possibility that what you are seeking does not exist.
There can be an active book or an active document but not both at the same time. It is also possible that there is neither an active book nor an active document.
When working with either an active book or an active document, you should check for the possibility that what you are seeking does not exist.
var doc, book;
book = app.ActiveBook;
if (book.ObjectValid()) {
Alert("Active book found", Constants.FF_ALERT_CONTINUE_NOTE);
} else {
doc = app.ActiveDoc;
if (doc.ObjectValid()) {
Alert("Active document found", Constants.FF_ALERT_CONTINUE_NOTE);
} else {
Alert("No active document or book found", Constants.FF_ALERT_CONTINUE_NOTE);
}
}
book = app.ActiveBook;
if (book.ObjectValid()) {
Alert("Active book found", Constants.FF_ALERT_CONTINUE_NOTE);
} else {
doc = app.ActiveDoc;
if (doc.ObjectValid()) {
Alert("Active document found", Constants.FF_ALERT_CONTINUE_NOTE);
} else {
Alert("No active document or book found", Constants.FF_ALERT_CONTINUE_NOTE);
}
}
No comments:
Post a Comment