![]() |
something just not right in code, please help!
I'm trying to save the workbook to the location it was opened from, update
it, upon closing it it will change the name acording that what is in cells a1 and a2 and then e-mail it to the specified address. Pleae take a look and let help with the correct coding. Sub Mail_Workbook_2() Dim wb1 As Workbook Dim wb2 As Workbook Dim wbname As String Application.ScreenUpdating = False Set wb1 = ActiveWorkbook wbname = " " & " " & MTR & " " _ Range ("a1") & ("a2) & ".xls" wb1.SaveCopyAs wbname Set wb2 = Workbooks.Open(wbname) With wb2 ..SendMail ", _ "MTR" ..Close False End With Application.ScreenUpdating = True End Sub -- Thanks for all of your help, Sherry |
something just not right in code, please help!
Hi Sherry,
Try: '============= Public Sub Mail_Workbook_2() Dim wb1 As Workbook Dim wb2 As Workbook Dim wbname As String Application.ScreenUpdating = False Set wb1 = ActiveWorkbook wbname = "MTR " & Range("A1").Value _ & Range("A2").Value & ".xls" wb1.SaveCopyAs wbname Set wb2 = Workbooks.Open(wbname) With wb2 .SendMail ", "MTR" .Close Savechanges:=False End With Application.ScreenUpdating = True End Sub '<<============= --- Regards, Norman "Sherry" wrote in message ... I'm trying to save the workbook to the location it was opened from, update it, upon closing it it will change the name acording that what is in cells a1 and a2 and then e-mail it to the specified address. Pleae take a look and let help with the correct coding. Sub Mail_Workbook_2() Dim wb1 As Workbook Dim wb2 As Workbook Dim wbname As String Application.ScreenUpdating = False Set wb1 = ActiveWorkbook wbname = " " & " " & MTR & " " _ Range ("a1") & ("a2) & ".xls" wb1.SaveCopyAs wbname Set wb2 = Workbooks.Open(wbname) With wb2 .SendMail ", _ "MTR" .Close False End With Application.ScreenUpdating = True End Sub -- Thanks for all of your help, Sherry |
All times are GMT +1. The time now is 02:20 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com