Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Need to convert 2010 excel macro to work in 2013

0

I have a macro writen in excel 2010 to create an Outlook email with the workbook as an attachement. Was working great in 2010, but as the work place upgrade to 2013, the macro falls ove at the email generation.

Can any one help with converting the following macro code to work in 2010 & 2013 versions of excel please?

  strOriginalName = ActiveWorkbook.FullName
    strName = ActiveWorkbook.Name
    strUserName = ActiveSheet.Range("D9")
    strUserName2 = ActiveSheet.Range("D11")
    strDate = Format(Date, "dd-mmm-yyyy") & " " & Format(Time, "hh-mm")
    ActiveWorkbook.SaveAs "H:\My Documents\" & strUserName & " " & strUserName2 & " " & "LEAVE_REQUEST_" & strDate & ".xlsm", FileFormat:= _
        xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
    strCurrentName = ActiveWorkbook.Name
    ' send REQUEST as attachment by email with subject as per requests status, version, Category & purpose etc.
   Application.Dialogs(xlDialogSendMail).Show arg1:=Range("D57").Value, arg2:=strCurrentName
'Sub CloseandSave()
ActiveWorkbook.Close SaveChanges:=True
End Sub "
Post Edited
CODE Tags: You must add [CODE][/CODE] tags around your code! (click the CODE button to do this when creating a post)
Answer
Discuss

Discussion

I only have Excel 2010 and it works for me, but, I researched it and it looks like the line of code Application.Dialogs(xlDialogSendMail).Show should not cause an issue in 2013. If you can include the full macro and also show us which line is causing the error, it might be easier to help.
don (rep: 1989) Feb 14, '17 at 5:01 am
Add to Discussion



Answer the Question

You must create an account to use the forum. Create an Account or Login