Newbie needs HELP!

I’m using NeroCom and Visual Basics to build my own burning app. I get the error message “Error Object Variable or With block variable not set” when I try to run my app. The form doesn’t even load. The following is my code:

Public WithEvents Nero As Nero
Public WithEvents Drive As NeroDrive
Dim nDrives As INeroDrives
Dim nFolder As INeroFolder
Dim nISOTrack As NeroISOTrack

Private Sub Form_Initialize()
Set Nero = New Nero
Set nDrives = Nero.GetDrives(NERO_MEDIA_CDR + NERO_MEDIA_CDRW)
Set Drive = nDrives(0)
End Sub

Private Sub Form_Load()
'initialize form buttons & list boxes
End Sub

I’m a newbie with NeroCom, so any hellp would be greatly appreciated.

Thanks,
Grace

The error must occur on some particular line. Can you please tell which one?

Thanks for the reply, but I already figured it out.

Grace

Grace, could you please let me know what you fixed in your code. I’m newbie on this one now and i’ve pulled down the sdk, dug through the PDF and played with the sample NeroCOM program and i can’t even get the Set nero = new nero part right.

Even when i cut/paste the declaration and set statements from the sample into my program

clues, tips, huge honking arrows, anything would help

Thanks,

I’m not understanding what I didn’t do to get the error. I declared and set a new NeroFile “tmpFile”, and as far as I can tell, the root folder is setup correctly, but I still get “Object doesn’t support this property or method” when it tries to add the file. Can it not take the way I’m designating the file? On walkthrough and watching, it seemed to set the name and source path correctly, but I’m still noob on this.


Private Sub cmdBurn_Click()
On Error GoTo handler
    
    Dim i As Integer
    Dim srcFldr As String
    Dim dstFldr As String
    Dim tmpFilename As String
    
    'CD burning variables
    Dim RootFolder As NeroFolder
    Dim tmpFile As NeroFile
    Dim tmpFldr As NeroFolder
    Dim ISOTrack As NeroISOTrack
    Dim indDrives As INeroDrives
   
    srcFldr = "C:\" & WTFldr
    cmdBurn.Enabled = False
    frmBackup.MousePointer = vbHourglass
    
    If optDevice(0).Value = True Then   'CD Burning
        Set RootFolder = New NeroFolder
        Set tmpFile = New NeroFile
        Set tmpFolder = New NeroFolder
        Set indDrives = nero.GetDrives(NERO_MEDIA_CDR + NERO_MEDIA_CDRW + NERO_MEDIA_DVD_M_R + NERO_MEDIA_DVD_M_RW + NERO_MEDIA_DVD_P_R + NERO_MEDIA_DVD_P_RW)
        Set Drive = indDrives(cboDevice.ListIndex)
        Set ISOTrack = New NeroISOTrack
        ISOTrack.Name = "WT Backup"
        ISOTrack.RootFolder = RootFolder
        For i = 0 To chkFiles.Count - 1
            If chkFiles(i).Value = 1 Then
                Select Case i
                    Case 0  'current WT Database
                        tmpFile.Name = "pmw" & WTVersion.iMajor & ".mdb"
                        tmpFile.SourceFilePath = srcFldr & "\" & tmpFile.Name
                        RootFolder.Files.Add (tmpFile)	*here is where the problem seems to be* Object doesn't support this property or method
                    Case 1  'Calibration Folder
                        tmpFldr.Name = "Calibration"
                        RootFolder.Folders.Add (GenerateTrack(srcFldr & "\Calibration", tmpFldr))
                    Case 2  'Excel Folder
                        tmpFldr.Name = "Data"
                        RootFolder.Folders.Add (GenerateTrack(srcFldr & "\Data", tmpFldr))
                    Case 3  'Archive Folder
                        tmpFldr.Name = "Archive"
                        RootFolder.Folders.Add (GenerateTrack(srcFldr & "\Archive", tmpFldr))
                    Case 4  'PMW.ini file (hopefully this won't be around for too much longer)
                        tmpFile.Name = "pmw" & WTVersion.iMajor & ".ini"
                        tmpFile.SourceFilePath = srcFldr & "\" & tmpFile.Name
                        RootFolder.Files.Add (tmpFile)
                    Case 5  'AHOffset.ini file (hopefully this won't be around for too much longer)
                        tmpFile.Name = "AHOffset.ini"
                        tmpFile.SourceFilePath = srcFldr & "\" & tmpFile.Name
                        RootFolder.Files.Add (tmpFile)
                    Case 6  'registry settings (working on this)
                    Case 7  'error log file
                        tmpFile.Name = "Error.log"
                        tmpFile.SourceFilePath = srcFldr & "\" & tmpFile.Name
                        RootFolder.Files.Add (tmpFile)
                    Case 8  'Header.dat file
                        tmpFile.Name = "Header.dat"
                        tmpFile.SourceFilePath = srcFldr & "\" & tmpFile.Name
                        RootFolder.Files.Add (tmpFile)
                    Case 9  'TestRaw.dat file
                        tmpFile.Name = "TestRaw.dat"
                        tmpFile.SourceFilePath = srcFldr & "\" & tmpFile.Name
                        RootFolder.Files.Add (tmpFile)
                    Case 10 'PPI files
                        If WTVersion.iMajor = 4 And WTVersion.iMinor = 1 Then
                            tmpFile.Name = "PPI.cbk"
                            tmpFile.SourceFilePath = srcFldr & "\" & tmpFile.Name
                            RootFolder.Files.Add (tmpFile)
                            
                            tmpFile.Name = "PPI.cfg"
                            tmpFile.SourceFilePath = srcFldr & "\" & tmpFile.Name
                            RootFolder.Files.Add (tmpFile)
                        Else
                            tmpFile.Name = "S7200PPI.cbk"
                            tmpFile.SourceFilePath = srcFldr & "\" & tmpFile.Name
                            RootFolder.Files.Add (tmpFile)
                            
                            tmpFile.Name = "S7200PPI.cfg"
                            tmpFile.SourceFilePath = srcFldr & "\" & tmpFile.Name
                            RootFolder.Files.Add (tmpFile)
                        End If
                    Case Else   'shouldn't happen, left for expansion
                End Select
            End If
        Next i
        ISOTrack.BurnOptions = NERO_BURN_OPTION_CREATE_ISO_FS + NERO_BURN_OPTION_USE_JOLIET
        If Drive.DeviceName = "Image Recorder" Then
            Drive.BurnImage "C:\imgtemp.iso", NERO_BURN_FLAG_CLOSE_SESSION + NERO_BURN_FLAG_WRITE, 4
        Else
            Drive.BurnIsoAudioCD vbNullString, vbNullString, False, ISOTrack, Nothing, Nothing, NERO_BURN_FLAG_CLOSE_SESSION + NERO_BURN_FLAG_WRITE, 4, NERO_MEDIA_CD
        End If
        '"Pop Star", "Title", 0, ISOTrack, Nothing, Nothing, NERO_BURN_FLAG_SIMULATE + NERO_BURN_FLAG_WRITE, 4, NERO_MEDIA_CD
        
    Else                                'Flash Drive/File Copy
        'other file copying procedure
    End If
    
    frmBackup.MousePointer = vbNormal
    cmdBurn.Enabled = True
    
    Exit Sub
handler:
    GlobalErrorHandler Err.Number, Err.Description, Err.Source, "cmdBurn", "frmBackup"
    Err.Clear
    Resume Next
End Sub