hoping this is a simple question - my coding is a bit rusty!
I've written a script to trim redundant characters from the end of (for example) the album name. I want to make it generic so I can pass in the field I want to trim.
So far I've got:
Code: Select all
' Get list of selected tracks from MediaMonkey
Set list = SDB.SelectedSongList
If list.count=0 Then
Set list = SDB.AllVisibleSongList
If pField = "Title" Then
tmp = list.item(0).Title
If pField = "Album" Then
tmp = list.item(0).AlbumName
If pField = "Artist" Then
tmp = list.item(0).ArtistName
MsgBox "Invalid field name: " & pField, vbOKOnly + vbExclamation
But rather than the convoluted nested if statement (or a replacement case statement) I'd like to pick the field dynamically. Something like:
tmp = list.item(0).field(pField)
So I can use pField to pick the relevant field to edit?