Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel,microsoft.public.excel.misc
|
|||
|
|||
![]()
Hello
Please could I beg a little advice from the experts here I'm using the following code to export data without quotation marks to text files. Sub Export() Dim r As Range, c As Range Dim sTemp As String Open "MyOutput.txt" For Output As #1 For Each r In Selection.Rows sTemp = "" For Each c In r.Cells sTemp = sTemp & c.Text & Chr(9) Next c 'Get rid of trailing tabs While Right(sTemp, 1) = Chr(9) sTemp = Left(sTemp, Len(sTemp) - 1) Wend Print #1, sTemp Next r Close #1 End Sub It works fine so long as the required cells are selected, but does anyone know how to amend the VBA to add the time and date to the filename? I'd be soooo grateful. I tried Open "MyOutput" & Format(Date, "yyyymmdd") & ".txt" For Output As #1 but that just crashed it. Any ideas? Many thanks tp |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
getting values from a filename as a date in a cell | Excel Discussion (Misc queries) | |||
Adding date for filename | Excel Discussion (Misc queries) | |||
Enter current date automatically in filename | Excel Worksheet Functions | |||
set filename to <filename-date on open | Excel Worksheet Functions | |||
How to automate footers (filename/date) for all new spreadsheets? | Excel Worksheet Functions |