Please Help

A

Al

I have a command button on a form that can open an excel
spread sheet file. I am doing this using the following code:
****************************************
Public Function UpdateLinks()
Dim Myfrm
Dim XL As Excel.Workbook, FName As String, strFlowchecker
As String, strFile As String
Dim RemoveButton As String
strFlowchecker = "FlowChekOpener.xls"
strFile = [Forms]![frmBloodTestsMain]![FileName]
Call Shell("""C:\Program Files\Microsoft
Office\Office\EXCEL.EXE"" /automation", 1)
Set XL = GetObject(strPath & strFile,
"Excel.Sheet")
XL.Application.Visible = True 'Make Excel Visible.
XL.Application.Windows(strFile).Visible = True
'Make the Workbook visible.
Set XL = GetObject(strPathFC & strFlowchecker,
"Excel.Sheet")
XL.Application.Windows(strFlowchecker).Visible
= False
'XL.Application.Run "RemoveButton"

End Function
*******************************************

My question is, How can I open Excel file as read only?
thanks
Al
 
D

Dan Artuso

Hi,
Do not use Shell to open Excel. Use CreateObject.
Then you can use the Open method of the Workbooks collection
to open it read only (it's one of the arguments).

HTH
Dan Artuso, MVP
 

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