LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Unable to get the Open property of the Workbooks class

Hello,

I have this function that works in other scripts but for this one it seems
to be having trouble. Here's the function...
Function WorkbookOpen(ByRef WorkBookName, LastUpdate, ReadOnly)

If IsObject(WorkBookName) = True Then
If Not WorkBookName Is Nothing Then
Set WorkbookOpen = objExcel.Workbooks(WorkBookName)
End If
Else
Dim fso, f1: Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FileExists(WorkBookName) Then
Set WorkbookOpen = Nothing
Subject = "Data Not Copied."
Message = WorkbookName & " Not Found."
Call SendMsg(objScript, Owner, "", Subject, Message)
Else
Set f1 = fso.GetFile(WorkBookName)
If LastUpdate = "" Then
If ReadOnly = "" Then
Set WorkbookOpen = objExcel.Workbooks.Open (WorkBookName)
Else
Set WorkbookOpen = objExcel.Workbooks.Open (WorkBookName,,xlReadOnly)
End If
Else
If DateValue(f1.DateLastModified) < DateValue(LastUpdate) Then
Set WorkbookOpen = Nothing
Subject = "Data Not Copied."
Message = WorkbookName & " Not Updated Since Last Refresh."
Call SendMsg(objScript, Owner, "", Subject, Message)
Else
If ReadOnly = "" Then
Set WorkbookOpen = objExcel.Workbooks.Open (WorkBookName)
Else
Set WorkbookOpen = objExcel.Workbooks.Open (WorkBookName,,xlReadOnly)
End If
End If
End If
End If
End If

Set fso = Nothing
set f1 = Nothing

End Function

When it gets to the Set WorkbookOpen = objExcel.Workbooks.Open
(WorkBookName) I get the error 1004 - Unable to get the Open property of the
Workbooks class. But as you can see in the function I already verify that
the workbook exists via FSO. Has anyone had this kind of trouble? I can
open the workbook manually with Excel, so I do not think the workbook is
corrupted. Could there be a setting in the workbook that causes this symptom?

Thank you in advance for any assistance.

Regards, Dean.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to get the Interior property of the PlotArea class [email protected] Charts and Charting in Excel 2 September 3rd 08 03:41 PM
Unable to set the XValues property of the Series class Ben Charts and Charting in Excel 7 December 7th 06 10:01 PM
Unable to get the Vlookup Property of the WorkSheetFunction Class monagan Excel Programming 2 August 3rd 04 09:32 PM
Unable to set the PrintQuality property of the PageSetup class. No Name Excel Programming 1 January 14th 04 04:43 PM


All times are GMT +1. The time now is 01:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"