
How to initialize Range object with Current page
For the purpose of those who follow this thread...........
=========================================================
_Application app;
Documents docs;
_Document doc;
Bookmarks bms;
Bookmark bm;
Range rng;
COleVariant opt((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
app.CreateDispatch("Word.Application");
app.SetVisible(TRUE);
docs = app.GetDocuments();
doc = docs.Open(COleVariant("1.doc"), &opt, &opt, &opt,
&opt, &opt, &opt, &opt,
&opt, &opt, &opt, &opt);
bms = doc.GetBookmarks();
bm = bms.Item(COleVariant("Page"));
rng = bm.GetRange();
rng.ReleaseDispatch();
bm.ReleaseDispatch();
bms.ReleaseDispatch();
doc.ReleaseDispatch();
app.Quit(&opt, &opt,&opt);
=========================================================
This code works well for all huge docs
except for the condition that the
caret position should be on the page
where we move the mouse.
If my caret position is on 3rd page and
i use the scroll bar and move to 7th page
then no result.
Still i do not have a complete idea how
to get words of the current page viewed by user.
bye
alex