Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

APPEARING FAILS OF SYSTEM INSTRUCTIONS

Status
Not open for further replies.

FSTN

Programmer
Jun 25, 2003
12
0
0
ES
Hi , I define '' Microsoft Universe '' as the place where things don't do what they were expected .

1º) I write the following text on a Word document :

"I use a Bookmark at the beggining .
I add a second line for proving this experiment ."

2º) I define and create a bookmark , after selecting the word '' Bookmark '' inside that text . So it's a Bookmark for the position of the word ''Bookmark'' . I name ''Here'' this Bookmark .

3º) I take the write cursor to the end of the second line ( after the word '' experiment '' ) .

4º) I feel really really interested in knowing why the following program does work :

Public Static Sub Experiment()
Word.Selection.GoToPrevious What:=wdGoToLine
End Sub

... but the other one does NOT work :

Public Static Sub Experiment()
Word.Selection.GoToPrevious What:=wdGoToBookmark
End Sub


Even if there is a reason and it is not a enormous misfunction , I think it explains why you never can start important a serious projects with Microsoft .



 
Do you expect Microsoft to guess what you want? You haven't told Word which bookmark to use!

Dim myrange As Word.Range
Set myrange = ActiveDocument.Bookmarks("Here").Range
myrange.InsertAfter myString

Before writing the whole company off, try reading the Help files

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 

First of all , thank you for your interest in answering me .

I was afraid that any little detail had escaped from my observation and that I was suggesting an erroneous experiment , and I was afraid that someone here showed me my error .... maybe it happens , but not with your kind answer , johnwm . Let's see .

My experiment has a real base . I'm querying specific information from Intel's Manuals for forming the schemes of Memory Management and Organization with Intel Processors . I have the Intel pdfs but I just have the light version of Acrobat Reader and so I have no posibilities of making boolean searches . I've taken the pdf information to a Word Document and I've programmed some useful work routines .

Well , one of my strategies is to insert certain bookmarks in different places of the Word document , and to enable two buttons for jumping from one bookmark to another , in both senses , up and down .

In this case I'm not interested in the names of the bookmarks . I just want to locate the next one or the previous one .

If you read Word's Help , you find the GoToNext and GoToPrevious methods . So the experiment I suggested above is not erroneous , or it seems not to be erroneous . Please read Word's Help about GoToNext and GoToPrevious methods .

It would be strange that I found in my applications help about any instruction , and this instruction were incompatible !!

So I go back to my Experiment again . If someone can give me a reasonable solution , I'll be grateful .

 
> Please read Word's Help about GoToNext and GoToPrevious methods .

I did you the courtesy of reading the Help for the above methods and I'm with johnwm.

Read the manual. The example is more than clear if you bother to read all of it.

Andy
"Logic is invincible because in order to combat logic it is necessary to use logic." -- Pierre Boutroux
"A computer program does what you tell it to do, not what you want it to do." -- Greer's Third Law
 

What example do you mean ? John's example ?

and what Manual ? Word's Help ?

Please if you do me the courtesy of reading Word's Help files , make sure before that you read carefully my first message here , thanks .

( I'm sorry I can't paste here an extract from my Word's Help ; the text I have is not written in English . However , the example instructions I can read are :

1º Ex --->

Selection.GoToPrevious What:=wdGoToField


2º Ex --->

Set myRange = ActiveDocument.Words.Last _
.GoToPrevious(What:=wdGoToFootnote)
myRange.Expand Unit:=wdCharacter

If they solve my experiment , in the exact terms how I've described it , please explain me .
)
 
what exactly is the issue here?

im assuming were talking VB (5 or 6) and not VBA!

what is your code where you create the selection/range?!?

[from MS word help]GoToPrevious Method

Range or Selection object: Returns a Range object that refers to the start position of the previous item or location specified by the What argument. If applied to a Selection object, GoToPrevious moves the selection to the specified item.

MailMessage object: Displays the previous mail message if you are using Word as your e-mail editor.

Syntax 1

expression.GoToPrevious(What)

Syntax 2

expression.GoToPrevious

expression Required. An expression that returns a Range or Selection object (Syntax 1) or a MailMessage object (Syntax 2).

What Required Long. The item that the specified range or selection is to be moved to. Can be one of the following WdGoToItem constants: wdGoToBookmark, wdGoToComment, wdGoToEndnote, wdGoToEquation, wdGoToField, wdGoToFootnote, wdGoToGrammaticalError, wdGoToGraphic, wdGoToHeading, wdGoToLine, wdGoToObject, wdGoToPage, wdGoToPercent, wdGoToProofreadingError, wdGoToSection, wdGoToSpellingError, or wdGoToTable.

GoToNext Method

Range or Selection object: Returns a Range object that refers to the start position of the next item or location specified by the What argument. If you apply this method to the Selection object, the method moves the selection to the specified item (except for the wdGoToGrammaticalError, wdGoToProofreadingError, and wdGoToSpellingError constants).

Note When you use this method with the wdGoToGrammaticalError, wdGoToProofreadingError, or wdGoToSpellingError constant, the Range object that's returned includes any grammar error text or spelling error text.

MailMessage object: Displays the next mail message if you are using Word as your e-mail editor.

Syntax 1

expression.GoToNext(What)

Syntax 2

expression.GoToNext

expression Required. An expression that returns a Range or Selection object (Syntax 1) or a MailMessage object (Syntax 2).

What Required Long. The item that the specified range or selection it to be moved to. Can be one of the following WdGoToItem constants: wdGoToBookmark, wdGoToComment, wdGoToEndnote, wdGoToEquation, wdGoToField, wdGoToFootnote, wdGoToGrammaticalError, wdGoToGraphic, wdGoToHeading, wdGoToLine, wdGoToObject, wdGoToPage, wdGoToPercent, wdGoToProofreadingError, wdGoToSection, wdGoToSpellingError, or wdGoToTable.[end]

good luck!

If somethings hard to do, its not worth doing - Homer Simpson
------------------------------------------------------------------------
come on... get involved!
To get the best response to a question, please check out FAQ222-2244 first
A General Guide To Excel in VB FAQ222-3383
 
Thank you very much for your detailed specifications . Now , please read the opening message of this thread and tell me what you think .

All I say is , simply , the following : Word tells you you can use the Word.Selection.GoToPrevious What:=wdGoToBookmark instruction , but when you use it , it doesn't work , that's all .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top