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
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