Re: Setting Cursor Position by bryan
bryan
Sun May 11 06:26:00 PDT 2008
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
"Gregory K. Maxey" wrote:
> It works here. Without seeing your complete code there really isn't much
> more I can offer.
>
>
> bryan wrote:
> > 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
> >
> > "Gregory K. Maxey" wrote:
> >
> >> 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
> >>
> >>
> >> bryan wrote:
> >>> How can I position the cursor at a certain bookmark upon opening a
> >>> new protected document?
> >>>
> >>> Thanks,
> >>> Bryan
>
>
>