Results 1 to 7 of 7

Excel 2007 : Help to Solve Run-time Error 424 "Object Required"

Threaded View

  1. #1
    D.S.Rama Rao
    Guest

    Help to Solve Run-time Error 424 "Object Required"

    I am getting Run-time Error 424 [Object required] At line No 30 [ Name = "D:\Hindi Music\" & Singer(K, 1) & "\Songs-Solo\" & Songsfile(j, 1) ]and subsequent code starting with line Nos 34,36,44,51,55 and 60 in the below Subroutine.
    Can any expert help me to solve this problem .
    Regards
    D S Rama Rao

    Public Sub PlayMedia()
    Dim t As Double
    Dim S As Integer
    Dim Songsfile As Variant
    Dim Sequence As Variant
    Dim Duration As Variant
    Dim Singers As Variant
    Dim CoSingers As Variant
    Dim Singer As Variant
    Dim FemaleSolo As Variant
    Dim MaleSolo As Variant
    Dim Name As Variant
    Set fso = CreateObject("Scripting.FilesystemObject")
    Songsfile = Range("B1:B26").Value 'Values from Excel worksheet in cell Nos B1 to B26 are Assigned to songsfile
    Sequence = Range("C1:C26").Value 'Values from Excel worksheet in cell Nos C1 to C26 are Assigned to Sequence of songs play
    Duration = Range("D1:D26").Value 'Values from Excel worksheet in cell Nos D1 to D26 are Assigned to Duration of song
    Singers = Range("E1:E26").Value 'Values from Excel worksheet in cell Nos E1 to E26 are Assigned to singers to identify singer
    CoSingers = Range("F1:F26").Value 'Values from Excel worksheet in cell Nos FD1 to F26 are Assigned to Cosingers for ID
    Singer = Range("G1:G14").Value 'Values from Excel worksheet in cell Nos G1 to G14 are Assigned to a group of singers
    FemaleSolo = Range("H1:H37").Value 'Values from Excel worksheet in cell Nos H1 to B37 are Assigned to a Group of female singers
    MaleSolo = Range("I1:I35").Value 'Values from Excel worksheet in cell Nos I1 to B35 are Assigned to Group of male singers
    t = Timer
    S = 0
    For i = 1 To UBound(Sequence)
    For j = 1 To UBound(Songsfile)
    If (Sequence(j, 1) = i) Then
    If IsEmpty(CoSingers(j, 1)) Then
    For K = 1 To UBound(Singer)
    If Singers(j, 1) Is Singer(K, 1) Then 'Identify the first song in sequence
    Name = "D:\Hindi Music\" & Singer(K, 1) & "\Songs-Solo\" & Songsfile(j, 1) 'Append Path of file depending upon singer
    ElseIf Singers(j, 1) Is Not Singer(K, 1) Then
    For L = 1 To UBound(FemaleSolo)
    If Singers(j, 1) Is FemaleSolo(L, 1) Then
    Name = "D:\Hindi Music\ Female Solo\ Songs-Solo\" & Songsfile(j, 1) 'Append Path of file depending upon singer
    Else
    Name = "D:\Hindi Music\ Male Solo\ Songs-Solo\" & Songsfile(j, 1) 'Append Path of file depending upon singer
    End If
    Next L
    End If
    Next K
    ElseIf CoSingers(j, 1) Is Singer(6, 1) Then
    For M = 7 To 8
    If Singers(j, 1) Is Singer(M, 1) Then
    Name = "D:\Hindi Music\" & Singers(j, 1) & "\Songs-Duets With Latha\" & Songsfile(j, 1)' 'Append Path of file as above
    End If
    Next M
    ElseIf CoSingers(j, 1) Is Not Singer(6, 1) Then
    For N = 1 To 8
    If N < 7 Then
    If Singers(j, 1) Is Singer(N, 1) Then
    Name = "D:\Hindi Music\" & Singers(j, 1) & "\Songs-Duets\" & Songsfile(j, 1)' 'Append Path of file as above
    End If
    ElseIf N > 6 Then
    If Singers(j, 1) Is Singer(N, 1) Then
    Name = "D:\Hindi Music\" & Singers(j, 1) & "\Songs-Duets With Others\" & Songsfile(j, 1) 'Append Path of file as above
    End If
    End If
    Next N
    Else
    Name = "D:\Hindi Music\Duets\Songs-Duets\" & Songsfile(j, 1) 'Append Path of file depending upon singer
    End If
    If fso.Fileexists(Pathway & ".mp3") Then ' Append file extension as mp3 and check if file exists
    Sheet1.WindowsMediaPlayer1.URL = Name & ".mp3"
    Sheet1.WindowsMediaPlayer1.Controls.Play
    S = S + Duration(j, 1)
    ElseIf fso.Fileexists(Pathway & ".wav") Then 'Append file extension as wav and check if file exists
    Sheet1.WindowsMediaPlayer1.URL = Name & ".wav"
    Sheet1.WindowsMediaPlayer1.Controls.Play
    S = S + Duration(j, 1) 'Calculate time required to play song
    Else
    MsgBox ("Song Not Found") ' Show massage that file does not exist
    End If
    End If
    Next j
    While Timer < t + S
    DoEvents 'Play song
    Wend
    Next i 'Increment the counter to play next sing in sequence
    End Sub
    Last edited by D.S.Rama Rao; 03-05-2012 at 12:21 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1