Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2005

Tip: Looking for answers? Try searching our database.

Bookmark Problem - how to write text to

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gina - 26 Feb 2005 14:02 GMT
Hi all.

I am trying to get some text to be written to a certain position but all it
does is to delete a command button I created on the document itself and to
write the text below exactly there
__________________________________________
Dim myRange

   Set myRange = ActiveDocument.Content
   myRange.Collapse Direction:=wdCollapseStart

   If myRange.BookmarkID = 0 Then
       ActiveDocument.Bookmarks.Add Name:="temp", Range:=myRange
   End If

   Selection.TypeText Text:="hallo macro1"
   Selection.TypeParagraph
__________________________________________

found it in the help .... but I don't really know what I am doing wrong
could anyone please show me the syntax to do that

Thanks in advance

Gina
Jean-Guy Marcil - 28 Feb 2005 16:03 GMT
Gina was telling us:
Gina nous racontait que :

> Hi all.
>
> I am trying to get some text to be written to a certain position but
> all it does is to delete a command button I created on the document
> itself and to write the text below exactly there

Here is what your code does:

> __________________________________________
> Dim myRange

This sets a range at the beginning of the document, just before the first
character.

>    Set myRange = ActiveDocument.Content
>    myRange.Collapse Direction:=wdCollapseStart

If there are no bookmarks at that range, create one and call it "temp"

>    If myRange.BookmarkID = 0 Then
>        ActiveDocument.Bookmarks.Add Name:="temp", Range:=myRange
>    End If

At the current cursor location (Which has nothing to do with he preceding
code) type the text "hallo macro1" and insert a ?.

>    Selection.TypeText Text:="hallo macro1"
>    Selection.TypeParagraph
> __________________________________________
>
> found it in the help .... but I don't really know what I am doing
> wrong could anyone please show me the syntax to do that

So, your code seems to be doing two totally unrelated things.
You wrote:
> I am trying to get some text to be written to a certain position but
How do you determine that position? Is it at the cursor location? A
bookmark? A picture? A table? etc.

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org


Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.