Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Accessing file properties | Excel Programming | |||
Accessing custom document properties in Word? | Excel Programming | |||
accessing custom document properties without loading file | Excel Programming | |||
Accessing File Properties | Excel Programming | |||
Accessing custom document properties | Excel Programming |