0
I have a spreadsheet that I use in my store that saves my orders in txt that in another spreadsheet I analyze all the data, but whenever I ask a new request and click to generate the TXT it opens the Save As dialog. Is there any way to skip this step and save it without opening the save as, specifying where to save? this macro I took on the internet and adapted for my use, but as I am layman this part I could not change. follows the macro:
Sub ExportRangetoFile()
'Update 20130913
Dim wb As Workbook
Dim saveFile As String
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Range("C6:Q20")
Set WorkRng = Range("C6:Q20")
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set wb = Application.Workbooks.add
WorkRng.Copy
wb.Worksheets(1).Paste
saveFile = Application.GetSaveAsFilename(fileFilter:="Text Files (*.txt), *.txt")
wb.SaveAs Filename:=saveFile, FileFormat:=xlText, CreateBackup:=False
wb.Close
Application.CutCopyMode = False
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
already this specified the cells that he exports to txt, everything works perfectly, it would only automate even more.
from now on thank
worked in parts, in my code it always generated a new file with the name Pasta1.txt Pasta2.txt successively, and so it subscribes the file Requests.txt. I need you to save a new file each time
– André Willemann
@Andréwillemann: How is the format you use to differentiate the files?
– Augusto Vasques
I did one more search here and got, I put down the solution.. thank you very much
– André Willemann
@Andréwillemann I made a modification see if it helps you.
– Augusto Vasques