Read & Write Mp3 File Tag Properties

May 31, 2008

The problem with the Write macro was that, although it did work, it used SendKeys which has to be slowed down considerably.

Here is a new version of the Write macro that works as normal. I originally tried to use CDDBControl.dll version 1.2.0.51 which is widely available on the internet but found that I could only get it to change 1 file before crashing Excel.

I have put the READ macro in the next message.

Dim ws As Worksheet
Dim FromRow As Long
Dim LastRow As Long
Dim FilesToChange As Integer ' number of files to change
Dim FilesChanged As Integer ' number of files changed
Dim MyFilePathName As String ' full path & file name
Dim MyFileType As String ' mp3 wma etc.
'-
Dim id3 As Object
Dim MyArtist As String
Dim MyAlbum As String
Dim MyGenre As String
Dim MyTrack As String
Dim MyTitle As String

Sub WRITE_TO_EXPLORER()
Application.Calculation = xlCalculationManual
Set ws = ActiveSheet
Set id3 = CreateObject("CDDBControlRoxio.CddbID3Tag")
LastRow = ws.Range("A65536").End(xlUp).Row ' count worksheet rows
FilesToChange = ws.Range("A2:A" & LastRow).SpecialCells(xlCellTypeVisible).Count
If FilesToChange = 0 Then MsgBox ("No files to change."): Exit Sub
FilesChanged = 0........................

View 3 Replies


ADVERTISEMENT

VBA Read/write .MP3 & .WMA Properties()

Jun 30, 2007

I have had a long-held belief that Excel/VBA methodology is very suited to solving this problem. I have investigated several possible methods noted below and picked one that gives a "quick win". I offer my results so far as a step towards the goal, as well as giving an example of how to manipulate a non-MS Office application using VBA. In this case Windows Explorer - I have used similar code on corporate applications like Oracle and SAP. My 'Write' method uses Sendkeys. Luckily I have been able to do the job without having to use code to simulate mouse functions or using API calls to simulate key presses. Ideally I would like to use something more stable, but there is the bonus that it is simple, as well as changing WMA and both versions of MP3 tag (see below) if present. Perhaps on reading this someone else may have a better method.

Being a ballroom dancer I have a large collection of CDs as well as software to rip to hard drive and enhance the sound quality. Many are quite old. A big problem has been to get a consistent view of the file properties - especially Genre, (eg. Waltz, Foxtrot .. etc.) which, from my own CD burning or external sources, is missing, or incorrect from using the now obsolete ID3v1 tag standard list. Applications such as Windows Media Player and RealPlayer allow functionality to edit tags but become very tiresome when it comes to making bulk changes - such as after burning a new CD. When viewing properties of the same file in various other applications they often show things like Title & Artist switched, and Genre not at all. I have tried software to change MP3 file tags, but find them over-complicated, confusing, and difficult to make the bulk changes I need. With Windows Explorer we can only change 8 properties - but I find these sufficient.

My method is :-

1. READ : Run one macro to put data into a worksheet.....

2. MAKE CHANGES : Make manual changes to the Excel worksheet in the normal way....

3. WRITE : Run another macro to read the worksheet and update the file properties in Explorer.

Part 1 is very simple and robust. Part 3 is difficult because when we use Sendkeys to mimic keyboard entry the code runs too fast to allow time for things to happen on screen, so we have to put Wait statements *depending on how fast the computer runs*. So Slower is better - up to a point.

Properties are added to MP3 files by using a "Tag" - additional bytes of information which form part of the file. WMA files are a Microsoft invention using a similar, but different structure. Interestingly, using my code to make changes via Window Explorer updates BOTH MP3 Tag versions as well as .WMA files. I moan about Microsoft less and less.

MP3 *ID3v1* consisting of 128 bytes always at the end of the file is now 'obsolete' - despite being still in use. This is very easy to read/write using the same code as for Text Files eg.


Open "c:myfile.mp3" For Binary As #1

etc. It is, however, limited to 4 text fields of 30 characters max, 'Year' =4 characters, and 'Genre' is a single character, the Asc() code of which is a lookup to a standard list which contains 125 items - none of which is any good to me. Could have my own lookup I suppose.

MP3 *ID3v2.3* is in the process of being superseded by ID3v2.4. The big problem here is that there are several different versions and the code required is extremely complicated - mainly due to the use of variable length fields. So we not only have to find the property, but read the field length before getting the field contents. Writing would need to change the coded field length. This is further complicated by there being the option to use an "Extended Tag" - *or not* ! Version 2 tag can be at the beginning or end of the file (before ID3v1 if it exists) - or both. The MP3 files on my computer all seem to have both versions - v2 at the beginning and v1 at the end. It is further complicated by the ability to have User Defined fields. I see some of my files have a user defined 'Genre' field, despite having the standard one 'TCON' too. The tag also needs a form of "encryption" so that the mp3 player does not treat it as audio data. Visit here for detailed information http://www.id3.org .

To view an audio file in its raw state open it in a Text Editor. I use 'TexPad' which is very fast and gives a choice of Binary (with Text 'translation' in a column) or Text view. Notepad gives just a Text view with empty space for non-text/binary characters. There is a large number of Null characters Asc(0) in proportion to the overall file length - mainly for "future development" I believe.

I would be interested to hear of any comments, suggestions and code improvements.

READ CODE IS IN THE "REPLY" BELOW

View 9 Replies View Related

Read-Write Popup - File Now Available

Apr 29, 2009

I have a tool that accesses a master sheet. Multiple people use the tool (sort of a user interface).

In some cases I need to write to the Master in which I check to make sure its not read only when the macro opens it (that works fine).

In other cases, like when just pulling information, read only is fine. But, I have not specified read only when I open the master.
Sometimes the users are getting a "File Now Available" with a read-write and cancel option. I do not want them to get this message.

My current universal call to master looks like this: ...

View 9 Replies View Related

To Read Many Text Files And Write It In The Excel File

Dec 11, 2009

I need help for reading data from text files and saving it under different columns in the excel file using vba macro.

For example: I have many text files in the following format ....

View 9 Replies View Related

Read Text File And Write Text

Feb 16, 2007

What if you have text that are hyperlinked to a txt file and you want to read from it and copy it into excel. What can I do then. Here is what I have been working on so far:


Sub GoToHyperLink()
Dim cell As Range
Dim link As Hyperlink
Dim Textline As String

Range("C2:C13").Select

For Each cell In Selection

Selection.Hyperlinks(1).Follow NewWindow:=False

I can not get it to write it to excel.

View 9 Replies View Related

Read And Write INI Files

Sep 21, 2009

Ok I have these ini files for a access control system. We have 40 different systems. All on different databases. that look like the following: ...

View 6 Replies View Related

Only Execute Code On A Write-access Basis, Not Read-only

Jul 6, 2009

I have recently used a before_close event on this workbook to save a backup of the open file to another location on my system. This works fine but I was wondering if there was some more code I could add to only execute this event on a write access basis.

The file I use can be viewed by anyone on the network as read-only and only certain users with a password can edit/update with a write access password.

The backup event is use executes every time the document is closed be it read-only or write-access.

Ideally I would like to add some code to only execute this backup if the file is opened on a write-access basis.

View 3 Replies View Related

Attempted To Read Or Write Protected Memory Error

Aug 20, 2009

I create and delete a conditional formatting rule programmatically. The issue I am facing is when I try to delete the conditional formatting rule that I programmatically created, I ran into the following errors:

1. Exception from HRESULT: 0x800A03EC
2. Attempted to read or write protected memory. this is often indication that other memory is corrupt.

I get these errors only when I have user created conditional formatting rules prior to deleting – I don’t want to delete all conditional formatting rules using FormatConditions.Delete(). Further, I can’t use FormatConditions[index].Delete() because I don’t have a index reference for the one that was created from the application.

Note: I have checked the Trust access to the VBA project object model.

View 8 Replies View Related

File May Be Read-Only, Or You May Be Trying To Access A Read-Only Location

Jan 4, 2007

I'm trying to open a file on a network drive...but I'm getting the following error message when it opens: "This file may be read-only, or you may be trying to access a read-only location. Or the server the document is stored on may not be responding." Now, the file itself has no rights restrictions and is not read only. It doesn't appear to be locked.

Now, there are other Excel files in the same directory which I could open fine; however, the Excel documents having the above problem all have a little black icon "appears to be a padlock" (image attached) at the bottom left hand side of the Excel file icon. I tried the following:

- Renaming
- Converting to a different file format (didn't work, it won't let me)
- Opening in notepad...etc doesn't work.

This file is dated back in 2004...do you think it's corrupt? Is there anything i can do to open or recover this?

View 2 Replies View Related

Read Cell Content & ADD Content + Font Properties *SOLVE

Sep 12, 2007

I use this to read cell content, add some text/characters (ie. [ and ]) and change the properties of the complete cell

Sub COMMENT()
Worksheets("DVD Lijssie").Activate
If ActiveCell.Value 0 Then ' Change all in to ... ... ...
ActiveCell.FormulaR1C1 = ActiveCell.Value & " " & "]" & " " & "["
With ActiveCell.Font
.Name = "Arial Narrow"
.Size = 8
.ColorIndex = 16
End With
End If
End Sub
HOW can I change this vba-code so it leave's the content of the cell like it is and add some content with the use of let's say TexBox1 and ONLY use different font properties for the newely added content?

View 9 Replies View Related

Modify/Edit File Properties Of CSV File

Jun 9, 2008

I need to modify/edit the properties of a CSV File. (Ex: Title, Subject, Author, Category, Keywords, Comments) through VBA

View 5 Replies View Related

Write VBA Code That Will Generate Text File With ALL Changes Made To Excel File

Jun 4, 2012

Is it possible to write vba code that will generate a text file with ALL changes that were made to an excel file. Ex. If Cell A17 = "Monday, June 4, 2012" and a user updates Cell A17 to "N/A", I would like to know what the value was before and after the udpate was made.

View 8 Replies View Related

Read Data From Column Write To Separate Column?

May 30, 2014

I am trying to write a formula to read the cells in column H individually if cell is blank write no to corresponding cell of column I, if the cell has any sort of data write yes to corresponding cell of column I

Currently H uses this formula ='name of column from sheet 1'!P:P

View 2 Replies View Related

Extract File Properties

Mar 1, 2012

I have a folder with some 126 word document files.

What I need is to create list of file names in a column & its properties like Author, Date modified in adjacent columns of each file..

View 1 Replies View Related

Excel 2003 :: How To Change Properties Of File

Jun 1, 2013

I have a question regarding the properties of an Excel file (.xls 2003). I can change them all (as indicated on Microsoft support website) expect the name of the last person who recorded the document (File ==> Properties==>Stat.)

How to change the name?

View 2 Replies View Related

Reading Custom Properties From A Closed File

Jul 7, 2008

I would like to read a few custom properties of excel workbook, even if they are close.

My intention is to build a list of compatible workbooks.

The compatibility woul be determined fom a custom property.

How can I read a custom property from a file wothout opening it?

View 9 Replies View Related

Extract File Properties From Workbooks Within Folder

Nov 19, 2009

I have a list of excel and word files in a folder...200+ of them. They all have the Author, Subject and Category populated under the File- Properties menu. From browsing through the site, I came across bits that suggest it is possible to do the following: Code that will run through a list of word/excel files in a designated folder, and extract the Excel(or Word) filename, Author, Subject and Category into a new excel file as a list?....................

View 6 Replies View Related

External File Properties In Cells. Last Saved Time

Feb 2, 2010

I was looking for a way to get external file froperties into a cell!

for example:

Last modified date.

this is what I allready found/tried.

View 8 Replies View Related

Modify/Edit File Properties (Date Modified) Of Workbook

Apr 8, 2008

I want to amend the ' Date Modified' for a spreadsheet. I have just made changes to it - so the 'Date Modified' shows today's date and time. Is there a way of changing the 'Date Modified' so it shows as yesterday's date?

View 3 Replies View Related

Why Won't This Write My Text File

Nov 21, 2006

I have verified that there is data in the worksheet...but while the text file is created and properly closed, nothing is written to it.

Sub ScoresToDeko() 'writes a text file
Dim Scores As String
Dim CRLF As String
Dim count As Integer

Scores = ""
CRLF = Chr$(13) & Chr$(10)

View 9 Replies View Related

Macro To Write CSV File

Dec 14, 2009

I have a CSV file that contains data in columns A-Q. Some cells may be blank.

I'm having trouble opening this CSV file because when I re-save it after editing it, Excel removes any quotes that were around the data.

Here is the criteria that the data must be formatted like:

If the value in column A = "H", the following columns need quotes around the cell - A-F, H-I, K-M, P-Q. The values in the rest of the columns do not need quotes.
If the value in column A = "D", the following columns need quotes around the cell - A-D, F, I-O, Q. The values in the rest of the columns do not need quotes. Data is only in columns A-Q.

Can somebody write a macro that will format the data as list above and save?

View 9 Replies View Related

Write Log To Text File

Jan 7, 2007

Are there any examples, instead of having MsgBox, but have a log file created ?

So instead of MsgBox, it might be MsgLog

Is there such a thing in VBA ?

View 6 Replies View Related

Write To Text File

Jan 4, 2008

I'm getting an object required error in excel, but don't really understand.

rivate Sub CommandButton1_Click()
free_number = FreeFile()
Filename = app.Path & "/file_write_output.txt"
StringToSave = Cells(1, 1).Value
Open Filename For Output As free_number
Write #free_number, StringToSave
Print #free_number, StringToSave
Close #free_number
End Sub

View 7 Replies View Related

How To Read CSV File

Sep 14, 2012

I used to read *.txt file into C/C++ program?

Now from Yahoo downloading stock prices, they are in EXCEL *.csv format. How can read them into C/C++ program?

View 5 Replies View Related

Read Only File

Apr 10, 2007

Is that possible that I can make an excel file as a read only through code... and if needed should be opened by giving password ?

View 6 Replies View Related

Write File Using Cell Value And Given Text

Mar 25, 2009

I found this thread ,

http://www.excelforum.com/excel-prog...in-a-cell.html
on the forum site which involves
saving a file by value in a cell.

I want to change the code so that it saves that name by
a cell value + "_BOM"

View 3 Replies View Related

Write Cell Contents To File?

Jun 2, 2014

Sometimes I want to have the abbility to quickly write cell data to a textfile. This is an effort:

Code:
Function Write_To_File(strMessage As String) As Boolean
'strMessage is a data in a cell
Log strMessage

[Code].....

Basically I want just one function that returns True for a succesfull write and False in case of an error. Now I have one function and one sub.

View 5 Replies View Related

Write A Line Into A HTML File With VBA

Jan 1, 2007

Say there is a HTML file at C:DataFile.html

I'd like to use Excel VBA to write this meta tag into that HTML file:

****** http-equiv="refresh" content="600">
That's to make it refresh every 600 seconds.

The most elegant way would be to locate the "head" tag and write it right after it, but the refreshing meta tag seems to work where ever it is, even at the very end of the file after the "/html" tag! So locating the "head" tag is not that important, if it's difficult.

So, how do I use VBA to write lines into a HTML (or any text) file?

View 9 Replies View Related

File Too Big...way To Parse Out Data And Write To Csv

Feb 12, 2010

I have a file with multiple tabs of data...lot's of data (each tab has 80,000+ lines and 23 columns...3 are formulas, the rest is imported data). I've brought Excel to it's knees (i.e. crashes). Yes, I'm using 2007.

What I'm trying to do is extract 6 cells of data from every 10th line and write it out to a CSV file with two more pieces of information (same for each line).

What I was doing was creating a separate worksheet for each one to be extracted, parsing out the data, and then copying that data to yet another workbook that was then saved as a CSV.

First, in retrospect, that was a waste of time. Second, the addition of the extra worksheets to do the parsing was crashing Excel due to the extreme size of the workbook.

What I'd like to do is use a macro to do all of this in one swell foop:

1) Prompt me for a file name (or I can put the desired name in a cell and read it from there if that simplifies the code)
2) Open a new text file with that name and ".csv" extension in the same folder as the original workbook
3) Write out the column headers: (Fix, Satellites, Lat, Lon, alt (ft), Date, utc_t, course)
4) Step through each row, looking at the text contents of column B (looks like 22:50:07.100)...if it ends in ".000" do the following:
4a) write "PPS,4," to the open text file
4b) write the cell contents from columns "V", "W", "J", "C", "B", and "L" to the text file in the exact format they appear in the text cell.

The output file should look like (very short example):

Fix,Satellites,Lat,Lon,alt (ft),Date,utc_t,course
PPS,4,30.543203,-86.323328,1419.04,2009/12/17,23:26:22.000,243.95
PPS,4,30.539272,-86.332765,1831.53,2009/12/17,23:26:34.000,242.61
PPS,4,30.535680,-86.340912,2281.16,2009/12/17,23:26:44.000,244.34

View 9 Replies View Related

Read Text File Using VBA

Jan 5, 2005

I know how to pull an entire text file
into an Excel Spreadsheet, but I only want specific information from
the text file not the entire text file.

What I have is about 25 text files stored in a folder, let's say
C: est.

Each file is named by a property address as follows:
209 MAIN ST.txt
213 MAIN ST.txt
111 ELM ST.txt
2356 WOOD AVE.txt

On the 11th row of each file is as follows:
Property Address:209 MAIN ST
On the 31st row of each file is as follows:
Total Value:30500

What I would like to do is read each file located in the "C: est
folder and write a record (row) into a single Excel Spreadsheet for
each property. I would like the Excel Spreadsheet to look as follows
once completed. Note the 1st row below is a header row that needs to
be generated by the code.

Property AddressTotal Value
209 MAIN ST 30500
213 MAIN ST 60700
111 ELM ST 20400
2356 WOOD AVE 20900

Can I read a header list (in a spreadsheet, text file, or hard coded in
the code) which I would prefer the spreadsheet or text file method,
write the header row in A1 then B1. Next read the 25 text files and
search based on the header info written above (Property Address & Total
Value) and write the appropriate to the single spreadsheet. The 11th
row of the First text file value written in cell A2, then read the 31st
row of the First text file write the value in cell B2, then loop to the
Second text file and values from The 11th row of the Second text file
value written in cell A3, then read the 31st row of the Second text
file write the value in cell B3, so on and so forth until the last text
file is read and the last record is written.

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved