Consulting

Results 1 to 5 of 5

Thread: "Function Call on left-hand side of assignment must return variant or object"

  1. #1

    "Function Call on left-hand side of assignment must return variant or object"

    Hi All, I have made a modification to some code, so that if I send an email it asks if i want to save the attachment or not in a different folder but i keep getting an error "Function Call on left-hand side of assignment must return variant or object"

    Doe anyone have any ideas how to solve this issue?

          If olItem.Sender Like "Nathan" Then 'INSERT NAME HERE        
            MsgBox("Save Attachments?", vbYesNo, "Save Attachments?") = vbYes
            SaveAttachments olItem, strPath & "\Documents\Documents Sent\"
        Else
            SaveAttachments olItem, strPath & "\Documents\Documents Received\"
        
        'If bExcel = True Then
        'CopyToExcel olItem, strPath
        
           End If
    lbl_Exit:
        Exit Sub
    End Sub

  2. #2
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    What are you trying to do with that MsgBox statement? You can't assign a value to it other than by clicking a button on the message box. I guess you meant to use another If...Then block?
    Be as you wish to seem

  3. #3
    If "yes" is selected then save then SaveAttachments olItem, strPath & "\Documents\Documents Sent\"
    if "no" is selected then end sub.




  4. #4
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
     If MsgBox("Save Attachments?", vbYesNo, "Save Attachments?") = vbYes Then
        SaveAttach..........
    End If
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  5. #5
    Thanks SamT, that has worked now!

Posting Permissions

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