Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Accessing Custom Doc Properties on Closed File

Is it possible to do this? I am trying to get data out of a team site and
I have the site mapped. We also have custom document properties for year,
month, etc. I'd like to only open those workbooks that meet a specified
selection. Can this be done, or can we only get the custom document
properties when the workbook is opened. Right now I'm opening every workbook
and looking at the properties, but I'd like to cut out the open step if
possible.

Thanks,
Barb Reinhardt
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Accessing Custom Doc Properties on Closed File

You can do this with DSOFile.dll or try this function:

Function GetFileProperty(vFolder As Variant, _
strFile As String, _
Optional lIndex As Long, _
Optional strItemName As String) As String

Dim i As Long
Dim objShell As Object
Dim objFolder As Object
Dim objFolderItem As Object
Dim arrHeaders(41)

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(vFolder)
Set objFolderItem = objFolder.ParseName(strFile)

If Len(strItemName) 0 Then
For i = 0 To 40
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
If arrHeaders(i) = strItemName Then
lIndex = i
Exit For
End If
Next
End If

GetFileProperty = objFolder.GetDetailsOf(objFolderItem, lIndex)

End Function


Use it like this:

Sub test()

MsgBox GetFileProperty("C:\ExcelFiles\", "MyFile.xls", , "Category")

End Sub


It works on for example text files as well.


RBS


"Barb Reinhardt" wrote in message
...
Is it possible to do this? I am trying to get data out of a team site
and
I have the site mapped. We also have custom document properties for year,
month, etc. I'd like to only open those workbooks that meet a specified
selection. Can this be done, or can we only get the custom document
properties when the workbook is opened. Right now I'm opening every
workbook
and looking at the properties, but I'd like to cut out the open step if
possible.

Thanks,
Barb Reinhardt


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Accessing Custom Doc Properties on Closed File

I'm actually wanting to check the properties of a PowerPoint presentation.
I'm getting an error on this line:

Set objFolderItem = objFolder.ParseName(strFile)

Run time error '91'
Object variable or With block variable not set

Any idea what the issue might be?

Thanks,
Barb Reinhardt
"RB Smissaert" wrote:

You can do this with DSOFile.dll or try this function:

Function GetFileProperty(vFolder As Variant, _
strFile As String, _
Optional lIndex As Long, _
Optional strItemName As String) As String

Dim i As Long
Dim objShell As Object
Dim objFolder As Object
Dim objFolderItem As Object
Dim arrHeaders(41)

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(vFolder)
Set objFolderItem = objFolder.ParseName(strFile)

If Len(strItemName) 0 Then
For i = 0 To 40
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
If arrHeaders(i) = strItemName Then
lIndex = i
Exit For
End If
Next
End If

GetFileProperty = objFolder.GetDetailsOf(objFolderItem, lIndex)

End Function


Use it like this:

Sub test()

MsgBox GetFileProperty("C:\ExcelFiles\", "MyFile.xls", , "Category")

End Sub


It works on for example text files as well.


RBS


"Barb Reinhardt" wrote in message
...
Is it possible to do this? I am trying to get data out of a team site
and
I have the site mapped. We also have custom document properties for year,
month, etc. I'd like to only open those workbooks that meet a specified
selection. Can this be done, or can we only get the custom document
properties when the workbook is opened. Right now I'm opening every
workbook
and looking at the properties, but I'd like to cut out the open step if
possible.

Thanks,
Barb Reinhardt



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Accessing Custom Doc Properties on Closed File

Can you post the actual code you did run?
Will try it on a PP file here.

RBS

"Barb Reinhardt" wrote in message
...
I'm actually wanting to check the properties of a PowerPoint presentation.
I'm getting an error on this line:

Set objFolderItem = objFolder.ParseName(strFile)

Run time error '91'
Object variable or With block variable not set

Any idea what the issue might be?

Thanks,
Barb Reinhardt
"RB Smissaert" wrote:

You can do this with DSOFile.dll or try this function:

Function GetFileProperty(vFolder As Variant, _
strFile As String, _
Optional lIndex As Long, _
Optional strItemName As String) As String

Dim i As Long
Dim objShell As Object
Dim objFolder As Object
Dim objFolderItem As Object
Dim arrHeaders(41)

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(vFolder)
Set objFolderItem = objFolder.ParseName(strFile)

If Len(strItemName) 0 Then
For i = 0 To 40
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
If arrHeaders(i) = strItemName Then
lIndex = i
Exit For
End If
Next
End If

GetFileProperty = objFolder.GetDetailsOf(objFolderItem, lIndex)

End Function


Use it like this:

Sub test()

MsgBox GetFileProperty("C:\ExcelFiles\", "MyFile.xls", , "Category")

End Sub


It works on for example text files as well.


RBS


"Barb Reinhardt" wrote in
message
...
Is it possible to do this? I am trying to get data out of a team
site
and
I have the site mapped. We also have custom document properties for
year,
month, etc. I'd like to only open those workbooks that meet a
specified
selection. Can this be done, or can we only get the custom document
properties when the workbook is opened. Right now I'm opening every
workbook
and looking at the properties, but I'd like to cut out the open step if
possible.

Thanks,
Barb Reinhardt




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Accessing Custom Doc Properties on Closed File

I'm trying it on a team site that's mapped to a drive. Might that be the
problem?

"RB Smissaert" wrote:

Can you post the actual code you did run?
Will try it on a PP file here.

RBS

"Barb Reinhardt" wrote in message
...
I'm actually wanting to check the properties of a PowerPoint presentation.
I'm getting an error on this line:

Set objFolderItem = objFolder.ParseName(strFile)

Run time error '91'
Object variable or With block variable not set

Any idea what the issue might be?

Thanks,
Barb Reinhardt
"RB Smissaert" wrote:

You can do this with DSOFile.dll or try this function:

Function GetFileProperty(vFolder As Variant, _
strFile As String, _
Optional lIndex As Long, _
Optional strItemName As String) As String

Dim i As Long
Dim objShell As Object
Dim objFolder As Object
Dim objFolderItem As Object
Dim arrHeaders(41)

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(vFolder)
Set objFolderItem = objFolder.ParseName(strFile)

If Len(strItemName) 0 Then
For i = 0 To 40
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
If arrHeaders(i) = strItemName Then
lIndex = i
Exit For
End If
Next
End If

GetFileProperty = objFolder.GetDetailsOf(objFolderItem, lIndex)

End Function


Use it like this:

Sub test()

MsgBox GetFileProperty("C:\ExcelFiles\", "MyFile.xls", , "Category")

End Sub


It works on for example text files as well.


RBS


"Barb Reinhardt" wrote in
message
...
Is it possible to do this? I am trying to get data out of a team
site
and
I have the site mapped. We also have custom document properties for
year,
month, etc. I'd like to only open those workbooks that meet a
specified
selection. Can this be done, or can we only get the custom document
properties when the workbook is opened. Right now I'm opening every
workbook
and looking at the properties, but I'd like to cut out the open step if
possible.

Thanks,
Barb Reinhardt






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Accessing Custom Doc Properties on Closed File

Probably yes.
Could you post the code you run to call the function?

RBS

"Barb Reinhardt" wrote in message
...
I'm trying it on a team site that's mapped to a drive. Might that be the
problem?

"RB Smissaert" wrote:

Can you post the actual code you did run?
Will try it on a PP file here.

RBS

"Barb Reinhardt" wrote in
message
...
I'm actually wanting to check the properties of a PowerPoint
presentation.
I'm getting an error on this line:

Set objFolderItem = objFolder.ParseName(strFile)

Run time error '91'
Object variable or With block variable not set

Any idea what the issue might be?

Thanks,
Barb Reinhardt
"RB Smissaert" wrote:

You can do this with DSOFile.dll or try this function:

Function GetFileProperty(vFolder As Variant, _
strFile As String, _
Optional lIndex As Long, _
Optional strItemName As String) As String

Dim i As Long
Dim objShell As Object
Dim objFolder As Object
Dim objFolderItem As Object
Dim arrHeaders(41)

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(vFolder)
Set objFolderItem = objFolder.ParseName(strFile)

If Len(strItemName) 0 Then
For i = 0 To 40
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
If arrHeaders(i) = strItemName Then
lIndex = i
Exit For
End If
Next
End If

GetFileProperty = objFolder.GetDetailsOf(objFolderItem, lIndex)

End Function


Use it like this:

Sub test()

MsgBox GetFileProperty("C:\ExcelFiles\", "MyFile.xls", , "Category")

End Sub


It works on for example text files as well.


RBS


"Barb Reinhardt" wrote in
message
...
Is it possible to do this? I am trying to get data out of a team
site
and
I have the site mapped. We also have custom document properties for
year,
month, etc. I'd like to only open those workbooks that meet a
specified
selection. Can this be done, or can we only get the custom document
properties when the workbook is opened. Right now I'm opening every
workbook
and looking at the properties, but I'd like to cut out the open step
if
possible.

Thanks,
Barb Reinhardt





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Accessing Custom Doc Properties on Closed File

Working fine here on a .ppt file:

Sub test()

MsgBox GetFileProperty("C:\ExcelFiles\", "test.ppt", , "Category")

End Sub


RBS

"Barb Reinhardt" wrote in message
...
I'm actually wanting to check the properties of a PowerPoint presentation.
I'm getting an error on this line:

Set objFolderItem = objFolder.ParseName(strFile)

Run time error '91'
Object variable or With block variable not set

Any idea what the issue might be?

Thanks,
Barb Reinhardt
"RB Smissaert" wrote:

You can do this with DSOFile.dll or try this function:

Function GetFileProperty(vFolder As Variant, _
strFile As String, _
Optional lIndex As Long, _
Optional strItemName As String) As String

Dim i As Long
Dim objShell As Object
Dim objFolder As Object
Dim objFolderItem As Object
Dim arrHeaders(41)

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(vFolder)
Set objFolderItem = objFolder.ParseName(strFile)

If Len(strItemName) 0 Then
For i = 0 To 40
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
If arrHeaders(i) = strItemName Then
lIndex = i
Exit For
End If
Next
End If

GetFileProperty = objFolder.GetDetailsOf(objFolderItem, lIndex)

End Function


Use it like this:

Sub test()

MsgBox GetFileProperty("C:\ExcelFiles\", "MyFile.xls", , "Category")

End Sub


It works on for example text files as well.


RBS


"Barb Reinhardt" wrote in
message
...
Is it possible to do this? I am trying to get data out of a team
site
and
I have the site mapped. We also have custom document properties for
year,
month, etc. I'd like to only open those workbooks that meet a
specified
selection. Can this be done, or can we only get the custom document
properties when the workbook is opened. Right now I'm opening every
workbook
and looking at the properties, but I'd like to cut out the open step if
possible.

Thanks,
Barb Reinhardt




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Accessing Custom Doc Properties on Closed File

I figured out my initial problem. It was my error. Dimensions didn't
match.

Now it's not finding the Custom Document Properties of these presentations.

In this section I added a debug.print statement to see what was being
returned.

If Len(strItemName) 0 Then
For i = 0 To 40
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
debug.print i,arrheaders(i)
If arrHeaders(i) = strItemName Then
lIndex = i
Exit For
End If
Next
End If

I got
0 Name
1 Size
2 Type
3 Date Modified
4 Date Created
5 Date Accessed
6 Attributes
7 Status
8 Owner
9 Author
10 Title
11 Subject
12 Category
13 Pages
14 Comments
15 Copyright
16 Artist
17 Album Title
18 Year
19 Track Number
20 Genre
21 Duration
22 Bit Rate
23 Protected
24 Camera Model
25 Date Picture Taken
26 Dimensions
27
28
29 Episode Name
30 Program Description
31
32 Audio sample size
33 Audio sample rate
34 Channels
35 Company
36 Description
37 File Version
38 Product Name
39 Product Version
40 Keywords
I've never seen some of these. Am I looking at the right thing?

"RB Smissaert" wrote:

You can do this with DSOFile.dll or try this function:

Function GetFileProperty(vFolder As Variant, _
strFile As String, _
Optional lIndex As Long, _
Optional strItemName As String) As String

Dim i As Long
Dim objShell As Object
Dim objFolder As Object
Dim objFolderItem As Object
Dim arrHeaders(41)

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(vFolder)
Set objFolderItem = objFolder.ParseName(strFile)

If Len(strItemName) 0 Then
For i = 0 To 40
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
If arrHeaders(i) = strItemName Then
lIndex = i
Exit For
End If
Next
End If

GetFileProperty = objFolder.GetDetailsOf(objFolderItem, lIndex)

End Function


Use it like this:

Sub test()

MsgBox GetFileProperty("C:\ExcelFiles\", "MyFile.xls", , "Category")

End Sub


It works on for example text files as well.


RBS


"Barb Reinhardt" wrote in message
...
Is it possible to do this? I am trying to get data out of a team site
and
I have the site mapped. We also have custom document properties for year,
month, etc. I'd like to only open those workbooks that meet a specified
selection. Can this be done, or can we only get the custom document
properties when the workbook is opened. Right now I'm opening every
workbook
and looking at the properties, but I'd like to cut out the open step if
possible.

Thanks,
Barb Reinhardt



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Accessing Custom Doc Properties on Closed File

Am I looking at the right thing?

Yes, you are looking at the right thing and it looks it should work.
Can you read the properties now?

RBS


"Barb Reinhardt" wrote in message
...
I figured out my initial problem. It was my error. Dimensions didn't
match.

Now it's not finding the Custom Document Properties of these
presentations.

In this section I added a debug.print statement to see what was being
returned.

If Len(strItemName) 0 Then
For i = 0 To 40
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
debug.print i,arrheaders(i)
If arrHeaders(i) = strItemName Then
lIndex = i
Exit For
End If
Next
End If

I got
0 Name
1 Size
2 Type
3 Date Modified
4 Date Created
5 Date Accessed
6 Attributes
7 Status
8 Owner
9 Author
10 Title
11 Subject
12 Category
13 Pages
14 Comments
15 Copyright
16 Artist
17 Album Title
18 Year
19 Track Number
20 Genre
21 Duration
22 Bit Rate
23 Protected
24 Camera Model
25 Date Picture Taken
26 Dimensions
27
28
29 Episode Name
30 Program Description
31
32 Audio sample size
33 Audio sample rate
34 Channels
35 Company
36 Description
37 File Version
38 Product Name
39 Product Version
40 Keywords
I've never seen some of these. Am I looking at the right thing?

"RB Smissaert" wrote:

You can do this with DSOFile.dll or try this function:

Function GetFileProperty(vFolder As Variant, _
strFile As String, _
Optional lIndex As Long, _
Optional strItemName As String) As String

Dim i As Long
Dim objShell As Object
Dim objFolder As Object
Dim objFolderItem As Object
Dim arrHeaders(41)

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(vFolder)
Set objFolderItem = objFolder.ParseName(strFile)

If Len(strItemName) 0 Then
For i = 0 To 40
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
If arrHeaders(i) = strItemName Then
lIndex = i
Exit For
End If
Next
End If

GetFileProperty = objFolder.GetDetailsOf(objFolderItem, lIndex)

End Function


Use it like this:

Sub test()

MsgBox GetFileProperty("C:\ExcelFiles\", "MyFile.xls", , "Category")

End Sub


It works on for example text files as well.


RBS


"Barb Reinhardt" wrote in
message
...
Is it possible to do this? I am trying to get data out of a team
site
and
I have the site mapped. We also have custom document properties for
year,
month, etc. I'd like to only open those workbooks that meet a
specified
selection. Can this be done, or can we only get the custom document
properties when the workbook is opened. Right now I'm opening every
workbook
and looking at the properties, but I'd like to cut out the open step if
possible.

Thanks,
Barb Reinhardt




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
Accessing file properties Blitzer99 Excel Programming 0 June 29th 05 10:29 PM
Accessing custom document properties in Word? quartz[_2_] Excel Programming 1 January 19th 05 02:27 AM
accessing custom document properties without loading file [email protected] Excel Programming 2 September 30th 04 01:47 AM
Accessing File Properties RWN Excel Programming 4 February 15th 04 01:39 AM
Accessing custom document properties Tim Haley Excel Programming 2 September 6th 03 02:34 AM


All times are GMT +1. The time now is 03:46 PM.

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

About Us

"It's about Microsoft Excel"