captainxcel
New Member
- Joined
- Jul 28, 2017
- Messages
- 35
- Office Version
- 2016
- Platform
- Windows
Hi Folks. I trade stocks. I just created a macro in a "template" file called CIA Trade Blotter Template.xlsm to paste value the trade date from a range that contains "today()" and then save the file (downgrading it to xlsx) with a datestamp appended to the filename [i.e. CIA Trade Blotter 10.25.17]. However, when run the macro and look into the folder where the new file is saved windows identifies the filetype as a ".17" file owing to the date format I prefer to use instead of as a "Microsoft Excel Worksheet". Other than changing the date format or placing the date first in the file naming sequence does anyone know what I'm doing wrong in my code or have a solution to this conundrum?
Sub SaveBlotter()
Range("trade_date").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Dim TradeDate, FileNameRoot
FileNameRoot = "CIA Trade Blotter "
TradeDate = Format((Now), "mm.dd.yy")
ActiveWorkbook.SaveAs Filename:=ActiveWorkbook.Path & "" & FileNameRoot & TradeDate, FileFormat:=xlOpenXMLWorkbook
End Sub
Sub SaveBlotter()
Range("trade_date").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Dim TradeDate, FileNameRoot
FileNameRoot = "CIA Trade Blotter "
TradeDate = Format((Now), "mm.dd.yy")
ActiveWorkbook.SaveAs Filename:=ActiveWorkbook.Path & "" & FileNameRoot & TradeDate, FileFormat:=xlOpenXMLWorkbook
End Sub
Last edited by a moderator: