Quantcast
Channel: General Office Development forum
Viewing all articles
Browse latest Browse all 2257

Assistance wtih Excel 2007 VBA Macro

$
0
0

My apologies if I entered this is the wrong Forum but I could not find one that exactly matched my question.  I have a client with a workbook containng 5 worksheets, each wtih a unique name, e.g.; Conroy, Trim, etc..  He will work on one worksheet then run a simple VBA macro that produces a new workbook, with only that one worksheet in it.  The macro names the new workbook "Supervisor Daily Log Sheet 2013-2014" which then gets e-mailed to other clientsMyclientwouldlikethe  new workbook name to start wtih the sheet name, e.g; "Conroy Supervisor Daily Log Sheet 2013-2014".  I have tried, without success, to edit the macro to include the sheet name in the resulting filename.  Could someone please look at this maco and show me what changes would result in a new filename which would include the sheet name?  Any help would be greatly appreciated. Thank you/

Sub ZoneMailer()

On Error Resume Next

Dim myDate As Date
Dim myFilename As String

myDate = Format(Date, "Long date")

myFilename = "SupervisorLog" & Year(myDate) & Month(myDate) & Day(myDate) & Format(Time, "AMPM")

ActiveSheet.Copy

Application.DisplayAlerts = False

ActiveWorkbook.SaveAs myFilename

Application.DisplayAlerts = True

ActiveSheet.PrintOut Copies:=1, Preview:=True

Application.Dialogs(xlDialogSendMail).Show Array("address1", "address2", "address3", "address4"),"Supervisor Log"

ActiveWorkbook.Close

On Error GoTo 0

End Sub


Viewing all articles
Browse latest Browse all 2257

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>