By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,057 Members | 1,407 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,057 IT Pros & Developers. It's quick & easy.

Hyperlink from labels to Word documents

P: 3
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.
Nov 27 '07 #1
Share this Question
Share on Google+
4 Replies


debasisdas
Expert 5K+
P: 8,127
Can you kindly post what you have tried so far to solve this problem.
Nov 27 '07 #2

Expert 5K+
P: 8,434
Also, what version of VB are you using? Is this the VBA macro language built into Word, or standalone VB, or what?
Nov 27 '07 #3

P: 3
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

Expand|Select|Wrap|Line Numbers
  1. Private Sub lblLocation_Click(Index As Integer)
  2. Dim Result As Long
  3.     Set db = New Connection
  4.     Set rs = New Recordset
  5.     query = "SELECT [location],[sno],[Initial],[Updated] FROM [tblDetails] WHERE [module_name] = '" & _
  6.              cmboModule.Text & "'"
  7.  
  8.     db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\DocTraK\DocTrak.mdb;"
  9.     rs.Open query, db, adOpenStatic, adLockOptimistic
  10.     For i = 0 To 4
  11.         lblLocation(i).Caption = ""
  12.         Next i
  13.  
  14.     If Not rs.BOF Then
  15.         rs.MoveFirst
  16.     End If
  17.  
  18.     rows = rs.RecordCount
  19.     For i = 1 To rows
  20.         If i > 5 Then
  21.             GoTo Over
  22.         End If
  23.         lblLocation(i - 1).Caption = rs.Fields(0)
  24.         rs.MoveNext
  25.     Next i
  26. Over:
  27.     db.Close
  28.     Result = MsgBox("Do You want to open the following document?", _
  29. vbYesNo + vbQuestion)
  30.     If Result = vbYes Then
  31.         Selection.Hyperlinks(i).rs.Fields (0)
  32.     Else
  33.         MsgBox "Please check the data is correct?", vbInformation
  34.     End If
  35. End Sub
I need a proper code to get open all the documents placed in the record set
Nov 28 '07 #4

P: 3
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
Nov 28 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.