View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default System Error &H80004005 (-2147467259). Unspecified error

When you create a new workbook using CTRL+N or "New" file the file menu,
Excel creates new, unsaved, workbook called, for example, "Book1" (note that
this is not "Book1.xls"). At this point the workbook Book1 has never been
saved. To test whether a workbook has ever been saved to disk, test the Path
value for vbNullString. E.g.,

If Workbooks(1).Path = vbNullString Then
Debug.Print "'Path' is empty, thus never been saved"
Else
Debug.Print "'Path' has value, thus it has been saved. Needs saving
now?: " & _
CStr(Not Workbooks(1).Saved)
End If


If Path (the folder name that contains the workbook) is an empty string, the
workbook has never been saved.

The Saved property is True or False indicating whether the workbook has been
modified since it was last saved, regardless of the Path value.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)



"Shimmess" wrote in message
...
How is it possible for it to never have been saved? Wouldn't the first
creation of an excel file require a save action? how do I error handle
around it?

"Chip Pearson" wrote:

You'll get that error if the workbook has never been saved.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"Shimmess" wrote in message
...
I have some code that reads in the last save data of an excel file using

MD = wb.BuiltinDocumentProperties("Last Save Time")


I came across a group of excel files that I tried running these on and
got
the following error:

System Error &H80004005 (-2147467259). Unspecified error

What could cause this? Shouldn't every excel file have a Last Saved
Time?