Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88111

How to save excel file in .bat?

$
0
0

I have this Code in Macro that i use to save files in csv. Is it possible now that i save this file in .bat Format ?

This is the Code i use :

Public Sub Export_File_as_CSV()

Dim wbkExport As Workbook
Dim shtToExport As Worksheet

Set shtToExport = ThisWorkbook.Worksheets("Export")     
Set wbkExport = Application.Workbooks.Add
shtToExport.Copy Before:=wbkExport.Worksheets(wbkExport.Worksheets.Count)
Application.DisplayAlerts = False                      
wbkExport.SaveAs Filename:="C:\Users\"& Environ("Username") & "\Desktop\User_Tableau.csv", FileFormat:=xlCSV, Local:=True
Application.DisplayAlerts = True
wbkExport.Close SaveChanges:=False
Sheets("Export").Select
Range("A1").Select

End Sub

Otherwise i have to save it in Excel and then again to convert in .txt file and then in .bat file. I try to automate all this steps with macro and save it .bat file.

Your help is much appriciated !

Thank you


Viewing all articles
Browse latest Browse all 88111

Trending Articles



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