Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Saving Files

Hi,

I need to be able to save my excel file into a text file which is Tab
delimited and name the file in another way than the usual <Name.txt

I am trying to save as the filename.date.time

The filename will always be the same, but the date and time will be whatever
the date and time is when the macro is run

example JezLisle.060323.093500

How is this possible????

Jez

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 336
Default Saving Files

This should do it (remember to type the correct path into it):

Sub SaveTab()
Dim myPath As String
Dim myFile As String
Dim myDot As Integer
myPath = "[your file path\]"
myFile = ActiveWorkbook.Name
myDot = InStr(myFile, ".") - 1
If myDot < -1 Then
myFile = Left(myFile, myDot)
End If
myFile = myFile & "." & Format(Date, "yymmdd") & "." & Format(Time,
"hhmmss")
ActiveWorkbook.SaveAs Filename:=myPath & myFile, FileFormat _
:=xlText, CreateBackup:=False
End Sub


"Jez" wrote:

Hi,

I need to be able to save my excel file into a text file which is Tab
delimited and name the file in another way than the usual <Name.txt

I am trying to save as the filename.date.time

The filename will always be the same, but the date and time will be whatever
the date and time is when the macro is run

example JezLisle.060323.093500

How is this possible????

Jez

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Saving Files

Martin,

Thanks for the code. It works a treat :-)

one question though as it only puts the time and date as the filename.

On your coding you wrote
myFile = ActiveWorkbook.Name
Is that where I put the filename of this file? As I changed
ActiveWorkbook.Name to JezLisle.

This is how I want the file to look JezLisle.060323.093500

but I got .060323.093500

Or if myfile should be Activeworkbook.Name how can I have JezLisle before
the .060323.093500

Thanks,
Jez.

"Martin" wrote:

This should do it (remember to type the correct path into it):

Sub SaveTab()
Dim myPath As String
Dim myFile As String
Dim myDot As Integer
myPath = "[your file path\]"
myFile = ActiveWorkbook.Name
myDot = InStr(myFile, ".") - 1
If myDot < -1 Then
myFile = Left(myFile, myDot)
End If
myFile = myFile & "." & Format(Date, "yymmdd") & "." & Format(Time,
"hhmmss")
ActiveWorkbook.SaveAs Filename:=myPath & myFile, FileFormat _
:=xlText, CreateBackup:=False
End Sub


"Jez" wrote:

Hi,

I need to be able to save my excel file into a text file which is Tab
delimited and name the file in another way than the usual <Name.txt

I am trying to save as the filename.date.time

The filename will always be the same, but the date and time will be whatever
the date and time is when the macro is run

example JezLisle.060323.093500

How is this possible????

Jez

  #4   Report Post  
Posted to microsoft.public.excel.programming
KR KR is offline
external usenet poster
 
Posts: 121
Default Saving Files

Jez-
not sure if you are still monitoring for replies, but just in case-
JezLisle (without quotes) is probably being seen as a variable, and unless
you assign a value to it, it will be blank.
Try putting quotes around it to make is a string, e.g. myfile = "JezLisle"
and I think it will append as desired.
HTH,
Keith

"Jez" wrote in message
...
Martin,

Thanks for the code. It works a treat :-)

one question though as it only puts the time and date as the filename.

On your coding you wrote
myFile = ActiveWorkbook.Name
Is that where I put the filename of this file? As I changed
ActiveWorkbook.Name to JezLisle.

This is how I want the file to look JezLisle.060323.093500

but I got .060323.093500

Or if myfile should be Activeworkbook.Name how can I have JezLisle before
the .060323.093500

Thanks,
Jez.

"Martin" wrote:

This should do it (remember to type the correct path into it):

Sub SaveTab()
Dim myPath As String
Dim myFile As String
Dim myDot As Integer
myPath = "[your file path\]"
myFile = ActiveWorkbook.Name
myDot = InStr(myFile, ".") - 1
If myDot < -1 Then
myFile = Left(myFile, myDot)
End If
myFile = myFile & "." & Format(Date, "yymmdd") & "." & Format(Time,
"hhmmss")
ActiveWorkbook.SaveAs Filename:=myPath & myFile, FileFormat _
:=xlText, CreateBackup:=False
End Sub


"Jez" wrote:

Hi,

I need to be able to save my excel file into a text file which is Tab
delimited and name the file in another way than the usual <Name.txt

I am trying to save as the filename.date.time

The filename will always be the same, but the date and time will be

whatever
the date and time is when the macro is run

example JezLisle.060323.093500

How is this possible????

Jez



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving files clzob Excel Discussion (Misc queries) 1 September 18th 09 03:35 AM
Saving files colleen Excel Discussion (Misc queries) 1 March 2nd 07 05:52 AM
Help - saving files MSL Excel Worksheet Functions 1 October 28th 06 03:34 PM
Closing files and saving files dan Excel Worksheet Functions 0 August 15th 06 04:07 AM
Saving csv files Steve Excel Discussion (Misc queries) 2 July 20th 05 06:43 PM


All times are GMT +1. The time now is 12:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"