PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

Changing properties of a file with VBA

 
 
Conan Kelly
Guest
Posts: n/a
 
      26th Nov 2008
Hello all,

x-posted:
microsoft.public.excel.programming
microsoft.public.vb.general.discussion

I was wondering if it is possible to change a property of a file
(right-click file in Windows Explorer (or [Alt] + [Enter]) >> Summary tab >>
"Advanced" button >> desired property) using VBA? Specifically, I want to
change the "Title" property of an MP3 file.

I'm using VBA in XL 2003 to do this. Right now, I have a loop that will
loop through each file and change the name of the file according to my
specifications using the File System Object in the Scripting Runtime
library. I want to have the code change the "Title" property of the file to
the file name (minus the extension), but it doesn't look like I can access
these properties using the FSO (or any other object) in the Scripting
Runtime library.

Does anyone know if it is possible to change these properties via code?
What objects I need to use/libraries I need to reference?

Thanks for any help anyone can provide,

Conan Kelly



---------------------------
"Smokin' weed kills your brain cells. Drinkin' only screws up your
liver...ya got 2 a those."
- Earl Hickey (NBC's "My Name is Earl")


 
Reply With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      26th Nov 2008
See http://www.cpearson.com/Excel/DocProp.aspx for code examples to
change the properties of both open and closed files.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)

On Wed, 26 Nov 2008 21:20:38 GMT, "Conan Kelly"
<(E-Mail Removed)> wrote:

>Hello all,
>
>x-posted:
>microsoft.public.excel.programming
>microsoft.public.vb.general.discussion
>
>I was wondering if it is possible to change a property of a file
>(right-click file in Windows Explorer (or [Alt] + [Enter]) >> Summary tab >>
>"Advanced" button >> desired property) using VBA? Specifically, I want to
>change the "Title" property of an MP3 file.
>
>I'm using VBA in XL 2003 to do this. Right now, I have a loop that will
>loop through each file and change the name of the file according to my
>specifications using the File System Object in the Scripting Runtime
>library. I want to have the code change the "Title" property of the file to
>the file name (minus the extension), but it doesn't look like I can access
>these properties using the FSO (or any other object) in the Scripting
>Runtime library.
>
>Does anyone know if it is possible to change these properties via code?
>What objects I need to use/libraries I need to reference?
>
>Thanks for any help anyone can provide,
>
>Conan Kelly
>
>
>
>---------------------------
>"Smokin' weed kills your brain cells. Drinkin' only screws up your
>liver...ya got 2 a those."
> - Earl Hickey (NBC's "My Name is Earl")
>

 
Reply With Quote
 
Conan Kelly
Guest
Posts: n/a
 
      26th Nov 2008
Chip,

Thanks for the feedback...quick response!!!

Correct me if I'm wrong, but it looks like the DSO OLE Document Properties
Reader 2.1 you referenced in your sheet is only meant to read/write
properties for MS Office files. It doesn't appear to work with MP3 files.

Being that DSO OLE Document Properties Reader 2.1 is written in C++ and I
know nothing about C++, I don't know if it will only work for MS Office
files or for any files...or if it can be modified to work on MP3 files.

Do you have any ideas of how to do this?

Thanks again for all of your help,

Conan






"Chip Pearson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> See http://www.cpearson.com/Excel/DocProp.aspx for code examples to
> change the properties of both open and closed files.
>
> Cordially,
> Chip Pearson
> Microsoft MVP
> Excel Product Group
> Pearson Software Consulting, LLC
> www.cpearson.com
> (email on web site)
>
> On Wed, 26 Nov 2008 21:20:38 GMT, "Conan Kelly"
> <(E-Mail Removed)> wrote:
>
>>Hello all,
>>
>>x-posted:
>>microsoft.public.excel.programming
>>microsoft.public.vb.general.discussion
>>
>>I was wondering if it is possible to change a property of a file
>>(right-click file in Windows Explorer (or [Alt] + [Enter]) >> Summary tab
>> >>

>>"Advanced" button >> desired property) using VBA? Specifically, I want to
>>change the "Title" property of an MP3 file.
>>
>>I'm using VBA in XL 2003 to do this. Right now, I have a loop that will
>>loop through each file and change the name of the file according to my
>>specifications using the File System Object in the Scripting Runtime
>>library. I want to have the code change the "Title" property of the file
>>to
>>the file name (minus the extension), but it doesn't look like I can access
>>these properties using the FSO (or any other object) in the Scripting
>>Runtime library.
>>
>>Does anyone know if it is possible to change these properties via code?
>>What objects I need to use/libraries I need to reference?
>>
>>Thanks for any help anyone can provide,
>>
>>Conan Kelly
>>
>>
>>
>>---------------------------
>>"Smokin' weed kills your brain cells. Drinkin' only screws up your
>>liver...ya got 2 a those."
>> - Earl Hickey (NBC's "My Name is Earl")
>>



 
Reply With Quote
 
Jeff Johnson
Guest
Posts: n/a
 
      27th Nov 2008
"Conan Kelly" <(E-Mail Removed)> wrote in message
news:wNkXk.44151$_(E-Mail Removed)...

> Correct me if I'm wrong, but it looks like the DSO OLE Document Properties
> Reader 2.1 you referenced in your sheet is only meant to read/write
> properties for MS Office files. It doesn't appear to work with MP3 files.
>
> Being that DSO OLE Document Properties Reader 2.1 is written in C++ and I
> know nothing about C++, I don't know if it will only work for MS Office
> files or for any files...or if it can be modified to work on MP3 files.


You're right. There are two separate ways to write these properties. One
deals with OLE documents (Office stuff), as you've discovered, and the other
uses alternate data streams, which is an NTFS-only (i.e., not FAT) concept.
We've discussed this in the VB group recently, maybe no more than three
months ago. Do a Google Groups search for keywords like "NTFS alternate
stream." You could narrow it down by putting my name as the author, since I
made at least one reply in the thread.


 
Reply With Quote
 
Norm Cook
Guest
Posts: n/a
 
      27th Nov 2008
"Conan Kelly" <(E-Mail Removed)> wrote in message
news:G4jXk.44025$_(E-Mail Removed)...
> Hello all,
>
> x-posted:
> microsoft.public.excel.programming
> microsoft.public.vb.general.discussion
>
> I was wondering if it is possible to change a property of a file
> (right-click file in Windows Explorer (or [Alt] + [Enter]) >> Summary tab
> >> "Advanced" button >> desired property) using VBA? Specifically, I want

> to change the "Title" property of an MP3 file.
>
> I'm using VBA in XL 2003 to do this. Right now, I have a loop that will
> loop through each file and change the name of the file according to my
> specifications using the File System Object in the Scripting Runtime
> library. I want to have the code change the "Title" property of the file
> to the file name (minus the extension), but it doesn't look like I can
> access these properties using the FSO (or any other object) in the
> Scripting Runtime library.
>
> Does anyone know if it is possible to change these properties via code?
> What objects I need to use/libraries I need to reference?
>
> Thanks for any help anyone can provide,
>
> Conan Kelly
>
>
>
> ---------------------------
> "Smokin' weed kills your brain cells. Drinkin' only screws up your
> liver...ya got 2 a those."
> - Earl Hickey (NBC's "My Name is Earl")


MP3 files may have ID3 tags. In general there
are two types of tag:

ID3V1 tags are simple, a 128 byte block of data that is
appended to the end of the file & contain

String literal "TAG"
Artist (30 bytes)
Title(30)
Album(30)
Comment(30)
Year(4)
Genre(1) ' for a lookup of standard genres

ID3V2 tags are more complex, variable in length, and, except
for some versions, are prepended at the beginning of the file. They
allow for all of the above info plus much more, such as
Custom Genre, Composer, Lyrics, Album image, BPM, etc.

Some references:
http://id3.org/ for general reading
http://id3.org/Developer_Information

This page has code to read/write your own tags:
http://www.vbaccelerator.com/home/VB..._Tags_Code.asp

Since you state VBA, you will likely need to adapt this
code to your own usage.






 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
FP Not Changing Changed File's Properties? jim evans Microsoft Frontpage 5 10th Nov 2006 05:47 PM
changing file properties =?Utf-8?B?Y29uZnVzZWQ=?= Windows XP Help 2 9th Jul 2006 03:20 AM
changing the properties of an excel file chocster@gmail.com Microsoft Excel Programming 2 19th Jan 2006 10:57 AM
Changing file properties Gilgamesh Microsoft C# .NET 2 13th Aug 2004 03:49 PM
Changing the File Save Properties Kirk Microsoft Excel Programming 1 25th Jul 2003 07:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:12 AM.