G
Guest
Hello all,
I am Using A2002 with Excel 2003. Trying to open a password protected excel
document via a button in Access.
I have tried a simple and complex, both results are the same. User clicks
READ ONLY when prompted by excel since it is password protected. The Excel
object being created, title displays, I can manually navigate and see the
value in the toolbar, BUT... the data in the excel doc does not seem to
refresh or repaint when it is loading.
Is there a better way? Is there something amuck in the code I am using?
Simple
***************************
dim strFile as String
strFile = "\\Server\cskc\Processes\Templates\Master Test Template.xls"
Application.FollowHyperlink strFile, , True
***************************
More complex, with same results
10 On Error GoTo cmd_Blank_MTT_Click_Error
'Unified Billing Master Test Template.xls
Dim strFile As String
Dim strWorkbookName As String
20 strFile = "\\Server\cskc\Processes\Templates\Master Test Template.xls"
23 strWorkbookName = strFile
'25 MsgBox "Template location is" & vbLf & vbLf & strFile,
vbInformation, Database
30 Application.FollowHyperlink strFile, , True
On Error Resume Next
Set objXL = GetObject(, "Excel.Application")
' An error will be raised if Excel isn't already open.
If Err.Number = 0 Then
booXLCreated = False
Else
Set objXL = CreateObject("Excel.Application")
booXLCreated = True
End If
On Error GoTo cmd_Blank_MTT_Click_Error
' Check to see if the workbook exists
If Len(Dir(strWorkbookName)) > 0 Then
objXL.Application.Workbooks.Open strWorkbookName
booWkbkCreated = False
Else
objXL.Application.Workbooks.Add
booWkbkCreated = True
End If
Set objActiveWkbk = objXL.Application.ActiveWorkbook
40 strFile = ""
PROC_EXIT:
50 Exit Sub
cmd_Blank_MTT_Click_Error:
60 If Err.Number = 1004 Then
'nothing
70 Else
80 MsgBox "Error Num " & Err.Number & " " & " ,Line: " & Erl & " In "
& " Unified_Billing_Phase_1.Form_Switchboard.cmd_Blank_MTT_Click", ,
"Database Error"
90 End If
100 Err.Clear
110 Resume PROC_EXIT
End Sub
I am Using A2002 with Excel 2003. Trying to open a password protected excel
document via a button in Access.
I have tried a simple and complex, both results are the same. User clicks
READ ONLY when prompted by excel since it is password protected. The Excel
object being created, title displays, I can manually navigate and see the
value in the toolbar, BUT... the data in the excel doc does not seem to
refresh or repaint when it is loading.
Is there a better way? Is there something amuck in the code I am using?
Simple
***************************
dim strFile as String
strFile = "\\Server\cskc\Processes\Templates\Master Test Template.xls"
Application.FollowHyperlink strFile, , True
***************************
More complex, with same results
10 On Error GoTo cmd_Blank_MTT_Click_Error
'Unified Billing Master Test Template.xls
Dim strFile As String
Dim strWorkbookName As String
20 strFile = "\\Server\cskc\Processes\Templates\Master Test Template.xls"
23 strWorkbookName = strFile
'25 MsgBox "Template location is" & vbLf & vbLf & strFile,
vbInformation, Database
30 Application.FollowHyperlink strFile, , True
On Error Resume Next
Set objXL = GetObject(, "Excel.Application")
' An error will be raised if Excel isn't already open.
If Err.Number = 0 Then
booXLCreated = False
Else
Set objXL = CreateObject("Excel.Application")
booXLCreated = True
End If
On Error GoTo cmd_Blank_MTT_Click_Error
' Check to see if the workbook exists
If Len(Dir(strWorkbookName)) > 0 Then
objXL.Application.Workbooks.Open strWorkbookName
booWkbkCreated = False
Else
objXL.Application.Workbooks.Add
booWkbkCreated = True
End If
Set objActiveWkbk = objXL.Application.ActiveWorkbook
40 strFile = ""
PROC_EXIT:
50 Exit Sub
cmd_Blank_MTT_Click_Error:
60 If Err.Number = 1004 Then
'nothing
70 Else
80 MsgBox "Error Num " & Err.Number & " " & " ,Line: " & Erl & " In "
& " Unified_Billing_Phase_1.Form_Switchboard.cmd_Blank_MTT_Click", ,
"Database Error"
90 End If
100 Err.Clear
110 Resume PROC_EXIT
End Sub