View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Force re-open file

Hi Jamie
you can try something like the following (only open the workbook if
it's not already opened):
sub foo()
Dim wbk As Workbook
Dim old_book as workbook
set old_book=activeworkbook
On Error Resume Next
Set wbk = Workbooks("newbook.xls")
On Error GoTo 0
If wbk Is Nothing Then
Workbooks.Open Filename:= "C:\newbook.xls"
end if
old_book.activate
end sub

--
Regards
Frank Kabel
Frankfurt, Germany


Jamie wrote:
I want to open a file weather it is open already or not. (ie to
refresh the data if any changes have been made by other users). Just
using workbooks.open works fine if the user clicks yes to the "do you
want to re-open this file" dialogue but errors if the user clicks no.
It would be good to skip the dialogue box and re-open the file every
time and just open normally if the file is not open to start with.

Thanks for any help

Jamie