Hi,
I have been searching for awhile but cannot find what I am trying to perform. I haven't programmed in VBA in awhile and never in Excel VBA, so I'm not handy with the objects, events etc. in it.
I have a spreadsheet with a bunch of summary information (about 500 rows) in it that some auditors are going to look at. In the last two columns of any particular row I have a pathway to a specific file which contains more detailed information about the row record. So, if an auditor has a question they can click the hyperlink and get to the file. In the column to the right is the password to open the specific file. As a convenience to the auditor I'd like to create a macro so that when they click the hyperlink and it automatically puts the password in there so that they don't have to input it.
Here's a screen shot of the two columns:
Hmmm... can't get a screen shot to work, looks like this:
Cell A has a hyperlink like: Filepath\filename.xls, Column B has a numeric password like: 12345
So, what I've done so far that does the action I want is this code. However, I want to be able to just click in the cell with the hyperlink on whatever row I am on and then open that file and pass in the password. Hoping that someone can give me a few pointers. Thanks in advance for any assistance!!
I have been searching for awhile but cannot find what I am trying to perform. I haven't programmed in VBA in awhile and never in Excel VBA, so I'm not handy with the objects, events etc. in it.
I have a spreadsheet with a bunch of summary information (about 500 rows) in it that some auditors are going to look at. In the last two columns of any particular row I have a pathway to a specific file which contains more detailed information about the row record. So, if an auditor has a question they can click the hyperlink and get to the file. In the column to the right is the password to open the specific file. As a convenience to the auditor I'd like to create a macro so that when they click the hyperlink and it automatically puts the password in there so that they don't have to input it.
Here's a screen shot of the two columns:
Hmmm... can't get a screen shot to work, looks like this:
Cell A has a hyperlink like: Filepath\filename.xls, Column B has a numeric password like: 12345
So, what I've done so far that does the action I want is this code. However, I want to be able to just click in the cell with the hyperlink on whatever row I am on and then open that file and pass in the password. Hoping that someone can give me a few pointers. Thanks in advance for any assistance!!
Code:
Sub OpenBooks()
Dim wkb1 As Workbook
Dim Cell As Range
For Each Cell In ThisWorkbook.Sheets("Sheet1").Range("A1")
Set wkb1 = Workbooks.Open(Filename:=Cell.Value, Password:=Cell.Offset(0, 1).Value, writerespassword:=Cell.Offset(0, 1).Value)
Next Cell
End Sub