Hi all,

How can i convert/change the code below to batch file command . Is this possible?

Sub Groupwise_SaveAttachToFile()

'Macro Purpose: Save all attachments of specified file type into a
'user specified folder using Groupwise
'NOTE:  Reference to Groupware Type Libary required

Dim ogwFolder As Folder, _
    ogwFoundFolder As Folder, _
    i As Long, _
    sCommandOptions As String, _
    sMailPassword As String, _
    sLoginname As String, _
    sFolderToSearch As String, _
    sFileType As String, _
    sSavePath As String, _
    ogwMail As Mail

'Change required variables here!
'sLoginname = "Farhah"
sFolderToSearch = "PCForm"
sSavePath = "C:\e-Report\PC" 'do not add trailing \
sFileType = "xls"

'Set application object reference if needed
If ogwApp Is Nothing Then 'Need to set object reference
     DoEvents
    Set ogwApp = CreateObject("NovellGroupWareSession")
    DoEvents
End If

'Create connection/login to email account
If ogwRootAcct Is Nothing Then 'Need to log in
    'Login to root account
    If Len(sMailPassword) Then 'Password was passed, so use it
        sCommandOptions = "/pwd=" & sMailPassword
    Else 'Password was not passed
        sCommandOptions = vbNullString
    End If
    Set ogwRootAcct = ogwApp.Login(sLoginname, sCommandOptions, _
    , egwPromptIfNeeded)
    DoEvents
End If

'Search all mail items, and save any matching attachments to the
'specified directory
For Each ogwMail In ogwRootAcct.AllFolders.ItemByName(sFolderToSearch).Messages
    With ogwMail
        If .Attachments.Count = 0 Then
            'No attachments, so do nothing
        Else
        
            'Attachments found.  Save desired type to specified folder
            For i = 1 To .Attachments.Count
            ActiveWorkbook.Unprotect
                If Right(.Attachments(i).Filename, 3) = sFileType Then
                        .Attachments(i).save _
                        sSavePath & "\" & _
                        Format(.CreationDate, "yyyy-mm-dd, hhmm") & ", " & _
                        .Attachments(i).Filename
                        
                        'IfElse
                        
                  

                End If
            Next i
        End If
    End With
Next ogwMail

'Release all objects before closing
Set ogwRootAcct = Nothing
Set ogwApp = Nothing
DoEvents
'ActiveWorkbook.Unprotect
ActiveSheet.Unprotect 'DrawingObjects:=False, Contents:=True, Scenarios:=True
ActiveWorkbook.save
    
End Sub

Appreciated any help.

Thanks,
~farha~