+ Reply to Thread
Results 1 to 8 of 8

Current work book .xlsm convert to xlsx work book then mail

  1. #1
    Registered User
    Join Date
    11-29-2016
    Location
    India
    MS-Off Ver
    2010 2007
    Posts
    59

    Current work book .xlsm convert to xlsx work book then mail

    Hi,

    I need some help in macro to convert the current macro enable work to normal work book & then e-mail. I've to send these to employees, after filling these sheets employee should be able to send in one click. Finally i need .xlsx out file from all employees as file name as there employee ID.

    Before e-mail i want a print preview of the sheet, then a msg box to make sure that the file is saved then mail the .xlsx workbook if it's not saved terminate the mail program stating that file is not saved.

    Can you please help me in convert the .xlsm to .xlsx work book before it get attached to e-mail. File attachment in mail should have only there employee ID (Emp_ID.xlsx).


    Note: I've two sheets in this work books & all these three sheets should be available as it is without any change.
    Attached Files Attached Files

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,231

    Re: Current work book .xlsm convert to xlsx work book then mail

    Hey there VCare

    Where are you saving to: Your path...i.e.
    "C:\Users\Steven\Desktop"

  3. #3
    Valued Forum Contributor kasan's Avatar
    Join Date
    07-22-2009
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    680

    Re: Current work book .xlsm convert to xlsx work book then mail

    Hi,
    Insert red part in your code. This will save current file as .xlsx file and attach it to email.
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    11-29-2016
    Location
    India
    MS-Off Ver
    2010 2007
    Posts
    59

    Re: Current work book .xlsm convert to xlsx work book then mail

    Hi sintek,

    Here the thing is i'll be sending macro enabled file to employees. As out put individual employees should fill the data in the file & click on Print & E-Mail, which should give me an out put in mail with excel work book. So in the folder option i'm expecting it should pick by it's own when employee save the initial document.

    Is this is possible?

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,231

    Re: Current work book .xlsm convert to xlsx work book then mail

    Hey VCare

    You wanna give this a try.

    Please Login or Register  to view this content.
    Last edited by sintek; 12-26-2016 at 09:20 AM.

  6. #6
    Registered User
    Join Date
    11-29-2016
    Location
    India
    MS-Off Ver
    2010 2007
    Posts
    59

    Re: Current work book .xlsm convert to xlsx work book then mail

    Hi kasan,

    thanks for you inputs. It was working fine. I just want to make a small change. I just want to mention a cell referent in file name. but im getting type match error.

    ActiveWorkbook.SaveAs Filename:=file_path + "\" + ActiveSheet.Range("B4").Value + ".xlsx", FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False

    Can you please correct me on this.

  7. #7
    Registered User
    Join Date
    11-29-2016
    Location
    India
    MS-Off Ver
    2010 2007
    Posts
    59

    Re: Current work book .xlsm convert to xlsx work book then mail

    Hi kasan,

    thanks for you inputs. It was working fine. I just want to make a small change. I just want to mention a cell referent in file name. but im getting type match error.

    ActiveWorkbook.SaveAs Filename:=file_path + "\" + ActiveSheet.Range("B4").Value + ".xlsx", FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False

    Can you please correct me on this.

  8. #8
    Valued Forum Contributor kasan's Avatar
    Join Date
    07-22-2009
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    680

    Re: Current work book .xlsm convert to xlsx work book then mail

    I would recommend to convert value of B4 to string, because "Filename" parameter should be string. If Range("B4").Value = 1234 (assuming its some kind of ID number) then this will rise error.
    Try this one:
    Please Login or Register  to view this content.

+ 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. VBA Code for populating cells from one Work Book A to another Work Book with condition
    By ray.kanata in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 06-22-2015, 03:46 PM
  2. Work book link to other work book
    By Mjh35 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-08-2014, 03:55 AM
  3. Mail different sheets to different email IDs of one work book
    By tameen42 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-06-2014, 01:52 PM
  4. current work book open
    By bigman8424 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-09-2012, 01:05 AM
  5. Replies: 2
    Last Post: 06-20-2012, 05:10 AM
  6. Refresh current work book?
    By Rick_Stanich in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-22-2005, 11:09 AM

Tags for this Thread

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