Please Help

  • Thread starter Thread starter Al
  • Start date Start date
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
 
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
 
Back
Top