open file with code

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

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

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

Back
Top