wondering101
New Member
- Joined
- Oct 3, 2009
- Messages
- 23
trying to get a worksheet to saveas .csv file to path when they hit macro button. however it opens TempWB and and does not save to path. Can someone tell me what I am missing here
Thanks
CJ
Thanks
CJ
Code:
[B]
Sub saveSheetToEQScan()
Dim myCSVFileName As String
Dim tempWB As Workbook
Application.DisplayAlerts = False
On Error GoTo err
' myCSVFileName = ThisWorkbook.Path & "\" & "Scan" & VBA.Format(VBA.Now, "dd-MMM-yyyy hh-mm") & ".csv"
myCSVFileName = "\\mlb-app2p\ShopEQ\EQScan\" & "Scan" & VBA.Format(VBA.Now, "dd-MMM-yyyy hh-mm") & ".csv"
ThisWorkbook.Sheets("Export For CSV").Activate
ActiveSheet.Copy
Set tempWB = ActiveWorkbook
With tempWB
.SaveAs Filename:=myCSVFileName, FileFormat:=xlCSV, CreateBackup:=False
.Close
End With
err:
Application.DisplayAlerts = True
End Sub
[Code]
[/B]