Hyperlink from labels to Word documents

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stsgiri
    New Member
    • Nov 2007
    • 3

    Hyperlink from labels to Word documents

    Hi,

    Need a vb code as like

    for control array elements(lables ) --- need to hyperlink .so the microsoft word document corresponding to the location should got displayed on the screen.

    I need a common code.the location of the array elements will be a table.

    Thanks in advance.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Can you kindly post what you have tried so far to solve this problem.

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Also, what version of VB are you using? Is this the VBA macro language built into Word, or standalone VB, or what?

      Comment

      • stsgiri
        New Member
        • Nov 2007
        • 3

        #4
        I have created a control array of labels having same label name. Backend database as access. I have specified the locations in the tables. I need a code for clicking a label. It should map to database and the path mentioned should be opened.

        Common array part is

        [CODE=vb]Private Sub lblLocation_Cli ck(Index As Integer)
        Dim Result As Long
        Set db = New Connection
        Set rs = New Recordset
        query = "SELECT [location],[sno],[Initial],[Updated] FROM [tblDetails] WHERE [module_name] = '" & _
        cmboModule.Text & "'"

        db.Open "PROVIDER=Micro soft.Jet.OLEDB. 4.0;Data Source=C:\DocTr aK\DocTrak.mdb; "
        rs.Open query, db, adOpenStatic, adLockOptimisti c
        For i = 0 To 4
        lblLocation(i). Caption = ""
        Next i

        If Not rs.BOF Then
        rs.MoveFirst
        End If

        rows = rs.RecordCount
        For i = 1 To rows
        If i > 5 Then
        GoTo Over
        End If
        lblLocation(i - 1).Caption = rs.Fields(0)
        rs.MoveNext
        Next i
        Over:
        db.Close
        Result = MsgBox("Do You want to open the following document?", _
        vbYesNo + vbQuestion)
        If Result = vbYes Then
        Selection.Hyper links(i).rs.Fie lds (0)
        Else
        MsgBox "Please check the data is correct?", vbInformation
        End If
        End Sub[/CODE]

        I need a proper code to get open all the documents placed in the record set
        Last edited by Killer42; Nov 28 '07, 08:17 AM. Reason: Added CODE=vb tag

        Comment

        • stsgiri
          New Member
          • Nov 2007
          • 3

          #5
          Originally posted by Killer42
          Also, what version of VB are you using? Is this the VBA macro language built into Word, or standalone VB, or what?
          In Vb 6.0,please help me to find out the solution

          Comment

          Working...