I have tried to write code to extract data from sheet "Man accounts bank" to a blank workbook and then to save this worksheet containing this sheet only to C:/my Documents and then to attach the file to be emailed
When running the macro, type mismatch 13 appears and the following code is highlighted
Your assistance in resolving this is most appreciated
Code:
Sub SendFiles()
Dim lCount As Long
Dim vFilenames As Variant
Dim sPath As String
Dim lFilecount As Long
Dim sFullName As String
sPath = "C:\My Documents\"
ChDrive sPath
ChDir sPath
Application.DisplayAlerts = False
Application.CutCopyMode = False
Sheets(Array("Man Accounts Bank")).Copy
ActiveWorkbook.SaveAs Replace(vFilenames(lCount), ".xls", "") & ".Man Accounts bank.xls", FileFormat:=xlNormal
vFilenames(lCount) = ActiveWorkbook.FullName
Application.ScreenUpdating = False
For Each sht In Sheets(Array("Man Accounts bank"))
Sheets(sht.Name).UsedRange.Copy
Sheets(sht.Name).Range("a1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Next
Application.ScreenUpdating = True
ActiveWorkbook.Close True
Application.DisplayAlerts = True
Application.CutCopyMode = True
'Mailfiles "", vFilenames
For lCount = LBound(vFilenames) To UBound(vFilenames)
Kill vFilenames(lCount)
Next
ActiveWorkbook.Close False
End Sub
When running the macro, type mismatch 13 appears and the following code is highlighted
Code:
ActiveWorkbook.SaveAs Replace(vFilenames(lCount), ".xls", "") & ".Man Accounts bank.xls", FileFormat:=xlNormal
Your assistance in resolving this is most appreciated