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