+ Reply to Thread
Results 1 to 17 of 17

Code that emails the last saved version of the Activeworkbook is broken

  1. #1
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Code that emails the last saved version of the Activeworkbook is broken

    I have the following code that is supposed to email the last saved version of the Activeworkbook. The code instead is emailing a blank workbook. Can someone help me fix this issue? I have attached a sample of my workbook for reference.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    12-01-2016
    Location
    Planet Earth
    MS-Off Ver
    95 - 2016
    Posts
    343

    Re: Code that emails the last saved version of the Activeworkbook is broken

    is the email server you're testing from blocking .xlsm files?
    Because I've tested your email code and its working

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,446

    Re: Code that emails the last saved version of the Activeworkbook is broken

    .
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Re: Code that emails the last saved version of the Activeworkbook is broken

    Syrkrasi- No my email server is not blocking xlms files

    Logit- Adding the file path you suggested ("C:\Users\My\Downloads\Live Trade Monitor - IB.xlsm") will not work because the Activeworkbook that is supposed to be sent is a newFile created everyday with a different name ("PnL m_dd_yy") that is created one step before in the macro Private Sub SaveDailyPnLFile. I have copied the SaveDailyPnLFile code below.

    Please Login or Register  to view this content.
    Last edited by rhudgins; 08-17-2017 at 04:10 PM.

  5. #5
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Re: Code that emails the last saved version of the Activeworkbook is broken

    Can anyone help me with this?

  6. #6
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,446

    Re: Code that emails the last saved version of the Activeworkbook is broken

    .
    If you can make certain the workbook you save is the only file to be in the folder ...

    Have a line at the beginning of the macro that deletes all files in the folder before saving anything there.

    Change your path of the attachment to select "all .xlsm files" ______*.xlsm______in the folder.
    Since there will only be one file in the folder, that is the one that will be selected as the attachment.

  7. #7
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Re: Code that emails the last saved version of the Activeworkbook is broken

    That is not possible because I need a new file saved everyday PnL 8_21_17, PnL 8_22_17 ect.

    My code has been running fine everyday for the last 5 years. A few weeks ago all of a sudden it stopped working.

    The portion of the code ".Attachments.Add ActiveWorkbook.FullName" is attaching a blank workbook with the correct file name. If I go to the folder where the file is saved the workbook has the correct file name as well as data in the file.

    Did excel/outlook make changes that would prevent my code from sending an attachment with data in the workbook?
    Last edited by rhudgins; 08-22-2017 at 03:00 PM.

  8. #8
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,446

    Re: Code that emails the last saved version of the Activeworkbook is broken

    .
    From reading the Forums, some things written in pre-2016 Excel don't run well or not at all in Excel 2016.

    If you need to retain the copies of the workbooks each day for future reference, move the saved file to a storage folder instead of deleting it at the beginning of the macro.

  9. #9
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Re: Code that emails the last saved version of the Activeworkbook is broken

    Thanks I assume it is a 2016 issue.

    Do you know the best code to email the Activeworkbook in excel 2016?

  10. #10
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,446

    Re: Code that emails the last saved version of the Activeworkbook is broken

    .
    I don't own Excel 2016 ... .but you can try this macro :

    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Re: Code that emails the last saved version of the Activeworkbook is broken

    That code you provided is not working either. Thanks trying to help

  12. #12
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,446

    Re: Code that emails the last saved version of the Activeworkbook is broken

    .
    Hmmm ......

    Makes me wonder about whether I want to upgrade to Excel 16.

    I am so sorry I haven't been able to assist you.


  13. #13
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,446

    Re: Code that emails the last saved version of the Activeworkbook is broken

    .
    Since the other thread is closed ....

    I hesitate to post a macro due to Excel 16 presenting issues for you. However, let's give it a go ?

    Please Login or Register  to view this content.
    Attached Files Attached Files

  14. #14
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,366

    Re: Code that emails the last saved version of the Activeworkbook is broken

    Another one to test.

    Please Login or Register  to view this content.
    Last edited by bakerman2; 08-24-2017 at 02:43 PM.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  15. #15
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Re: Code that emails the last saved version of the Activeworkbook is broken

    The second code that you provided worked great! Thanks for all of your help and patients!

  16. #16
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,446

    Re: Code that emails the last saved version of the Activeworkbook is broken

    .
    Me ?

    You are welcome.

  17. #17
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,366

    Re: Code that emails the last saved version of the Activeworkbook is broken

    @ Logit

    Maybe me ?

    @ rhudgins

    You're welcome and thanks for rep+.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] ActiveWorkbook.Saved = True isn't saving changes to a CSV File
    By DaveBre in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-08-2014, 08:09 PM
  2. [SOLVED] Excel 2010: Concatenated URL broken when saved to PDF
    By doubler2k7 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-24-2013, 06:36 PM
  3. How can I recover last saved version?
    By HelpExc in forum Excel General
    Replies: 3
    Last Post: 02-13-2013, 12:16 AM
  4. [SOLVED] Saved emails with attachments
    By ir26121973 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-04-2006, 02:10 PM
  5. [SOLVED] Recover earlier version of excel sheet after new version saved?
    By stephanie38 in forum Excel General
    Replies: 3
    Last Post: 06-16-2005, 11:05 PM
  6. How to retrieve last saved version.
    By Deichelb in forum Excel General
    Replies: 1
    Last Post: 01-27-2005, 04:06 PM
  7. [SOLVED] How to retrieve last saved version?
    By Deichelb in forum Excel General
    Replies: 1
    Last Post: 01-27-2005, 03:06 PM

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