Open Excel doc issues

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
 
G

Guest

Sorry, I got it to work, kinda of. Only difference I can tell is I rem'd out
the follow Hyperlink on line 30.

I used this code and it opens completely so the users can see all fields,
but if I do not already have an instance of Excel open, it opens the excel
document with no tool bars or file menu, so the user's can't save the
document to their desktop.

What commands can i use to show the tool bar and the standard toolbar?

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 wheter 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top