Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2008

Tip: Looking for answers? Try searching our database.

error opening a workbook

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
budi1568 - 23 Jan 2008 05:48 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.