DeadSpace4
New Member
- Joined
- Nov 8, 2011
- Messages
- 4
Hey all, this is my first post here so please bear with me.
I am attempting to create a macro that will be used in hundreds of very similar Excel files. The files are for a sales replenishment system and most of the information will be the same from week to week. However, the store number to which the order is to be shipped will change and it is this cell that needs to be referenced in the file name along with the date that the purchase order is being completed.
Additionally, the file needs to be saved as both a .xlsm format (to be used again the following week) AND a Tab Delimited format, as the replenishment software will only recognize a Text file.
The ultimate goal here is to create 400+ spreadsheets that will be filled out manually each week with the store numbers, PO numbers, date, etc and then all the quantities that are to be shipped to each store. To expedite the process of exporting 400+ Tab Delimited Text files to their proper location I need to create this Save As macro.
The file name needs to be something similar to "832-11.8.2011.txt". Additionally, and hopefully within the same macro, I can get it to save a copy with the same file name but in a Macro Enabled XLS file as well.
I hope I am not being to confusing here.
This is what I've got so far for the macro:
Sub SaveAsTDTXTFile()
'
' SaveAsTDTXTFile Macro
'
' Keyboard Shortcut: Ctrl+e
'
ThisFile = Range("O1").Value
ActiveWorkbook.SaveAs Filename:=ThisFile
End Sub
As you can see, I need to get the current date into the name of the file as well as having the lines for saving it as both the .txt file and the .xlsm file. I would also like to use the FileFormat numbers so that the macro is recognizable to versions before 2007.
Eventually, I will also need to have the .txt file saved to a different location (a network drive on our VPN) and the .xlsm file to the local hard drive. But for now I can settle for both being on the local drive.
Thanks in advance.
I am attempting to create a macro that will be used in hundreds of very similar Excel files. The files are for a sales replenishment system and most of the information will be the same from week to week. However, the store number to which the order is to be shipped will change and it is this cell that needs to be referenced in the file name along with the date that the purchase order is being completed.
Additionally, the file needs to be saved as both a .xlsm format (to be used again the following week) AND a Tab Delimited format, as the replenishment software will only recognize a Text file.
The ultimate goal here is to create 400+ spreadsheets that will be filled out manually each week with the store numbers, PO numbers, date, etc and then all the quantities that are to be shipped to each store. To expedite the process of exporting 400+ Tab Delimited Text files to their proper location I need to create this Save As macro.
The file name needs to be something similar to "832-11.8.2011.txt". Additionally, and hopefully within the same macro, I can get it to save a copy with the same file name but in a Macro Enabled XLS file as well.
I hope I am not being to confusing here.
This is what I've got so far for the macro:
Sub SaveAsTDTXTFile()
'
' SaveAsTDTXTFile Macro
'
' Keyboard Shortcut: Ctrl+e
'
ThisFile = Range("O1").Value
ActiveWorkbook.SaveAs Filename:=ThisFile
End Sub
As you can see, I need to get the current date into the name of the file as well as having the lines for saving it as both the .txt file and the .xlsm file. I would also like to use the FileFormat numbers so that the macro is recognizable to versions before 2007.
Eventually, I will also need to have the .txt file saved to a different location (a network drive on our VPN) and the .xlsm file to the local hard drive. But for now I can settle for both being on the local drive.
Thanks in advance.