Hi,
I'm opening up a password protected spreadsheet from an Outlook form. All is fine apart from the code falls over when trying to send the password in the code. If you remove the password:="password" it works fine.
Anybody any ideas?
Thanks
Tim
Function fCheckAuthorisation(strNameToAuthorise)
Dim objExcel
Dim strFilePath
Dim strFileName
Dim intExcelRow
Dim intExcelColumn
Dim intLoopValue
Dim strName
fCheckAuthorisation = False
strFilePath = ("c:\"
strFileName = ("approval.xls"
Set objExcel = CreateObject("Excel.Application.10"
objExcel.Workbooks.Open strFilePath & strFileName, Password:=("password"
intExcelRow = 1
intExcelColumn = 1
strName = objExcel.Application.Cells(intExcelRow, intExcelColumn)
Do Until strName = ""
strName = objExcel.Application.Cells(intExcelRow, intExcelColumn)
If strName = strNameToAuthorise Then
fCheckAuthorisation = True
Exit Do
End If
intExcelRow = intExcelRow + 1
intLoopValue = intLoopValue + 1
Loop
objExcel.Quit
Set objExcel = Nothing
End Function
I'm opening up a password protected spreadsheet from an Outlook form. All is fine apart from the code falls over when trying to send the password in the code. If you remove the password:="password" it works fine.
Anybody any ideas?
Thanks
Tim
Function fCheckAuthorisation(strNameToAuthorise)
Dim objExcel
Dim strFilePath
Dim strFileName
Dim intExcelRow
Dim intExcelColumn
Dim intLoopValue
Dim strName
fCheckAuthorisation = False
strFilePath = ("c:\"
strFileName = ("approval.xls"
Set objExcel = CreateObject("Excel.Application.10"
objExcel.Workbooks.Open strFilePath & strFileName, Password:=("password"
intExcelRow = 1
intExcelColumn = 1
strName = objExcel.Application.Cells(intExcelRow, intExcelColumn)
Do Until strName = ""
strName = objExcel.Application.Cells(intExcelRow, intExcelColumn)
If strName = strNameToAuthorise Then
fCheckAuthorisation = True
Exit Do
End If
intExcelRow = intExcelRow + 1
intLoopValue = intLoopValue + 1
Loop
objExcel.Quit
Set objExcel = Nothing
End Function