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 / May 2008

Tip: Looking for answers? Try searching our database.

Setting Cursor Position

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bryan - 10 May 2008 13:32 GMT
How can I position the cursor at a certain bookmark upon opening a new
protected document?

Thanks,
Bryan
Gregory K. Maxey - 10 May 2008 18:42 GMT
Bryan,

If you are wanting to select the range of certain formfield in a protected
document then you would use something like this:

Sub Document_Open()
ActiveDocument.Bookmarks("Your Bookmark Name").Range.Fields(1).Result.Select
End Sub

> How can I position the cursor at a certain bookmark upon opening a new
> protected document?
>
> Thanks,
> Bryan
bryan - 10 May 2008 19:38 GMT
That does not work. I have this in my Document_New()

ActiveDocument.Bookmarks("Text29").Range.Fields(1).Result.Select
       
Rather than positioning here it is positioned on my Dropdown1 which I have
pre-selected a value but, need it capable of changing.
I would like to position on text29

Thanks,
Bryan

> Bryan,
>
[quoted text clipped - 10 lines]
> > Thanks,
> > Bryan
Gregory K. Maxey - 10 May 2008 21:13 GMT
It works here.  Without seeing your complete code there really isn't much
more I can offer.

> That does not work. I have this in my Document_New()
>
[quoted text clipped - 21 lines]
>>> Thanks,
>>> Bryan
bryan - 11 May 2008 14:26 GMT
I am trying to set the cursor location at the end.
Thanks for looking at this.
here is my complete code for doc_new:

Private Sub Document_New()

On Error Resume Next
Set objIRConn = CreateObject("irdesktopcontrol.irdesktopcontrolx")
 
If VarType(objIRConn) > 0 Then
   objIRConn.Active = True
   
   If objIRConn.Active Then
   
                 
       'Account Number
           strAcctNum = objIRConn.FileNum
           'strFC = Left(strAcctNum, 1)
            'Do While strFC = "0"
               'strAcctNum = Right(strAcctNum, Len(strAcctNum) - 1)
               'strFC = Left(strAcctNum, 1)
            'Loop
           ActiveDocument.FormFields("Text5").Result = strAcctNum
                               
       'Insured Name
           strInsName = objIRConn.FileName
           ActiveDocument.FormFields("Text6").Result = strInsName
               
       'Underwriter
           'strUW = Mid(objIRConn.SecIndex1, 1, 3)
           'ActiveDocument.FormFields("Text34").Result = strUW
                     
       Set objconn = CreateObject("ADODB.Connection")
       objconn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist
Security Info=False;User ID=sa;Initial Catalog=ImageRight;Data Source=SQ01"

        'Address
         'strquery = "select userdata4, userdata5 from folder where drawer
= 'DBIL' and foldernumber = '" & objIRConn.FileNum & "'"
       'Set objcount = objconn.Execute(strquery)
        'If Not objcount.EOF Then
         'straddr = Trim(objcount("userdata4").Value)
         'strcsz = Trim(objcount("userdata5").Value)
         'ActiveDocument.FormFields("Text8").Result = straddr & " " & strcsz
        'End If
         
        'Agency
         strquery1 = "select userdata2 from folder where drawer = 'DBIL'
and foldernumber = '" & objIRConn.FileNum & "'"
       Set objcount1 = objconn.Execute(strquery1)

        If Not objcount1.EOF Then
         strUD2 = Mid(objcount1(0), 8, 6)
        Else
         strUD2 = ""
        End If
         ActiveDocument.FormFields("Text11").Result = strUD2
                 
        If strUD2 <> "" Then
         strquery2 = "select foldername, userdata2, userdata4, userdata5
from folder where drawer = 'MKTG' and foldernumber = '" & strUD2 & "'"
         Set aginfo = objconn.Execute(strquery2)
          If Not aginfo.EOF Then
           strUDA = aginfo("foldername").Value
           strAgPhone = aginfo("userdata2").Value
           strAgAddr = aginfo("userdata4").Value
           strAgCsz = aginfo("userdata5").Value
          End If
        End If
        'Agency
         ActiveDocument.FormFields("Text30").Result = Trim(strUDA)
         ActiveDocument.FormFields("Text31").Result = Trim(strAgAddr) & " "
& Trim(strAgCsz)
         ActiveDocument.FormFields("Text32").Result = Trim(strAgPhone)
         
   ActiveDocument.Bookmarks("Text29").Range.Fields(1).Select
       
   End If
   Set objIRConn = Nothing
Else
End If
ActiveDocument.Bookmarks("Text29").Range.Fields(1).Result.Select
       
End Sub

> It works here.  Without seeing your complete code there really isn't much
> more I can offer.
[quoted text clipped - 24 lines]
> >>> Thanks,
> >>> Bryan
bryan - 11 May 2008 14:51 GMT
I found the issue. I was setting the focus on text29 which is a formfield
with type "number". If I changed to text32, a text type it works fine.

Thanks,
Bryan


> It works here.  Without seeing your complete code there really isn't much
> more I can offer.
[quoted text clipped - 24 lines]
> >>> Thanks,
> >>> Bryan
 
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.