Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe you can use the code at this site.
http://support.microsoft.com?kbid=138621 "budi1568" wrote: 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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) budi1568 wrote: 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 -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Great!!!
Thanks Dave...really works fine "Dave Peterson" wrote: 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) budi1568 wrote: 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 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Error msg on opening excel workbook | Excel Discussion (Misc queries) | |||
Error msg on opening Excel Workbook | Excel Discussion (Misc queries) | |||
Error while opening workbook | Excel Discussion (Misc queries) | |||
error when opening a workbook | Excel Programming | |||
Error in opening workbook | Excel Programming |