of ObjectHallo
Is there anybody can help me since I am new in VB and having case as follow:
I am working with two workbook where when I open the 1st workbook it will
open the second one. The problem is if the second file already open I got an
error message : Run Time Error 1004.
Methode 'OPen of Object 'Workbooks' failed
Private Sub Workbook_Open()
Workbooks.Open Filename:="O:\2009 Budget\Forecast 2008\Forecast Q Rep
08.xls" _
, UpdateLinks:=0
End Sub
Thanks for helping me
JLGWhiz - 23 Jan 2008 16:11 GMT
Maybe you can use the code at this site.
http://support.microsoft.com?kbid=138621
> of ObjectHallo
> Is there anybody can help me since I am new in VB and having case as follow:
[quoted text clipped - 10 lines]
>
> Thanks for helping me
Dave Peterson - 23 Jan 2008 16:26 GMT
Check to see if it's open first:
Private Sub Workbook_Open()
dim TestWkbk as workbook
set testwkbk = nothing
on error resume next
set testwkbk = workbooks("forecast q rep 08.xls") '<- no path here
on error resume next
if testwkbk is nothing then
'it's not open
set testwkbk = Workbooks.Open _
(Filename:="O:\2009 Budget\Forecast 2008\Forecast Q Rep 08.xls", _
UpdateLinks:=0)
end if
End Sub
(Untested, uncompiled--watch for typos)
> of ObjectHallo
> Is there anybody can help me since I am new in VB and having case as follow:
[quoted text clipped - 10 lines]
>
> Thanks for helping me

Signature
Dave Peterson
budi1568 - 27 Jan 2008 05:13 GMT
Great!!!
Thanks Dave...really works fine
> Check to see if it's open first:
>
[quoted text clipped - 30 lines]
> >
> > Thanks for helping me