Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Who last opened file?

Hi All...........

John Walkenbach has an article on his site that describes how to use WordPad
to see who was the last person to open a particular .xls file.......it's here

http://j-walk.com/ss/excel/odd/odd26.htm

My question is, how to use VBA to interrogate a .xls file and extract
this information?

TIA
Vaya con Dios,
Chuck, CABGx3




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Who last opened file?

You can do this with the DSOFile DLL available at
http://support.microsoft.com/kb/224351/en-us . This DLL allows you to read
and modify built-in and custom properties of OLE file, which includes most
Office files (Excel, PowerPoint, Visio, etc).


Function LastUser(FileName As String) As String
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''
' Returns the Excel Application.UserName (as set in the Options
' dialog) of the user who last saved the file named by
' FileName. This file must NOT be open.
' Requires a reference to DSOFile, DSOFile.dll. See
' http://support.microsoft.com/kb/224351/en-us
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''
Dim DSO As DSOFile.OleDocumentProperties
Set DSO = New DSOFile.OleDocumentProperties

If Dir(FileName, vbNormal + vbSystem + vbHidden) = vbNullString Then
LastUser = vbNullString
Else
DSO.Open FileName
LastUser = DSO.SummaryProperties.LastSavedBy
End If
End Function

There are two versions of the DSOFile DLL floating around, "DSO OLE Document
Properties Reader 2.1" and "DS: OLE Document Properties 1.4 Object Library".
The code above is for version 2.1, the version you should be using. This
will also work on XLSM and XLSX files.


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

"CLR" wrote in message
...
Hi All...........

John Walkenbach has an article on his site that describes how to use
WordPad
to see who was the last person to open a particular .xls file.......it's
here

http://j-walk.com/ss/excel/odd/odd26.htm

My question is, how to use VBA to interrogate a .xls file and extract
this information?

TIA
Vaya con Dios,
Chuck, CABGx3





  #3   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 207
Default Who last opened file?

Chuck

I think it will be rather difficult to get to the text string that
shows up when you use Notepad to be viewable in an Excel file. It
would be easy to write the name of the user who opens a file into a
text file whenever a file is opened. The reading of that text file
would be easy. If you are interested in that approach, you should
repost, as I am sure there are plenty on instances of code available
to write to text files to track activity in a spreadsheet.

Ken

On Jan 4, 9:36*am, CLR wrote:
Hi All...........

John Walkenbach has an article on his site that describes how to use WordPad
to see who was the last person to open a particular .xls file.......it's here

http://j-walk.com/ss/excel/odd/odd26.htm

My question is, *how to use VBA to *interrogate a *.xls file and extract
this information? *

TIA
Vaya con Dios,
Chuck, CABGx3


  #4   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Who last opened file?

Thanks Ken, but that solution requires that I previously set code within the
file. I want to be able to check ANY .xls file.

Vaya con Dios,
Chuck, CABGx3



"Ken" wrote:

Chuck

I think it will be rather difficult to get to the text string that
shows up when you use Notepad to be viewable in an Excel file. It
would be easy to write the name of the user who opens a file into a
text file whenever a file is opened. The reading of that text file
would be easy. If you are interested in that approach, you should
repost, as I am sure there are plenty on instances of code available
to write to text files to track activity in a spreadsheet.

Ken

On Jan 4, 9:36 am, CLR wrote:
Hi All...........

John Walkenbach has an article on his site that describes how to use WordPad
to see who was the last person to open a particular .xls file.......it's here

http://j-walk.com/ss/excel/odd/odd26.htm

My question is, how to use VBA to interrogate a .xls file and extract
this information?

TIA
Vaya con Dios,
Chuck, CABGx3



  #5   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Who last opened file?

Thanks Chip, but the comments say that it "Returns the Excel
Application.UserName (as set in the Options dialog) of the user who last
SAVED the file named by FileName."

The signature I am after does not require that the last "opener" save the
file. It shows up in WordPad, I just don't know how to get it over into
Excel......or, alternatively, if I open the file, how to retrieve it from
there.

Vaya con Dios,
Chuck, CABGx3



"Chip Pearson" wrote:

You can do this with the DSOFile DLL available at
http://support.microsoft.com/kb/224351/en-us . This DLL allows you to read
and modify built-in and custom properties of OLE file, which includes most
Office files (Excel, PowerPoint, Visio, etc).


Function LastUser(FileName As String) As String
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''
' Returns the Excel Application.UserName (as set in the Options
' dialog) of the user who last saved the file named by
' FileName. This file must NOT be open.
' Requires a reference to DSOFile, DSOFile.dll. See
' http://support.microsoft.com/kb/224351/en-us
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''
Dim DSO As DSOFile.OleDocumentProperties
Set DSO = New DSOFile.OleDocumentProperties

If Dir(FileName, vbNormal + vbSystem + vbHidden) = vbNullString Then
LastUser = vbNullString
Else
DSO.Open FileName
LastUser = DSO.SummaryProperties.LastSavedBy
End If
End Function

There are two versions of the DSOFile DLL floating around, "DSO OLE Document
Properties Reader 2.1" and "DS: OLE Document Properties 1.4 Object Library".
The code above is for version 2.1, the version you should be using. This
will also work on XLSM and XLSX files.


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

"CLR" wrote in message
...
Hi All...........

John Walkenbach has an article on his site that describes how to use
WordPad
to see who was the last person to open a particular .xls file.......it's
here

http://j-walk.com/ss/excel/odd/odd26.htm

My question is, how to use VBA to interrogate a .xls file and extract
this information?

TIA
Vaya con Dios,
Chuck, CABGx3







  #6   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Who last opened file?

In the testing I've done, it appears the value i seek is always preceeded by
the following, if that will help find it in the file.

_p____

that's Underscore, lowercase p, and four more underscores......

Vaya con Dios,
Chuck, CABGx3



"CLR" wrote:

Hi All...........

John Walkenbach has an article on his site that describes how to use WordPad
to see who was the last person to open a particular .xls file.......it's here

http://j-walk.com/ss/excel/odd/odd26.htm

My question is, how to use VBA to interrogate a .xls file and extract
this information?

TIA
Vaya con Dios,
Chuck, CABGx3




Reply
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
macro to autofilter other file and copy in opened file matthias Excel Programming 4 August 17th 06 10:52 AM
code to check file size everytime an Excel file is opened Kaiser[_2_] Excel Programming 2 July 30th 06 05:46 PM
stop excel file opened as read only if already opened by another u bobm Excel Programming 3 August 5th 05 04:11 PM
Is Workbook read-only because of file permission or because file is already opened? balexis Excel Programming 0 September 29th 04 02:29 PM
How set file open path to filepath of file opened with Explorer ? RandyDtg1 Excel Programming 0 May 14th 04 02:05 AM


All times are GMT +1. The time now is 11:09 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"