View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
kassie kassie is offline
external usenet poster
 
Posts: 515
Default open file with code

I open files as follows:

varDir = CurDir()
On Error GoTo Opened
Set wSource = Worksheets("----")
Workbooks.Open (varDir & "\----.xls"), _
Notify = False, ReadOnly = False
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Heading
Exit Sub
Opened:
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Your code here, I use a sub name here, to go to the next stage. So if
the next stepis maybe the insertion of headings, which is done with Sub
Headings(), I would put Headings here.


--
HTH

Kassie

Replace xxx with hotmail


"Steve" wrote:

Seems as though if I open a workbook using Workbooks.Open(Filename:=xxx) and
the file is in use I don't get the "file in use" dialog. I want to know if
I'm opening a read only copy. Any workaround?