Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Append DateTime to Fiename, saveCopy

Hi All...........

I'm having trouble with the following code in XL97/SR2.....getting "cant
find file" error and not making the copy.........could anybody tell me what's
wrong please?

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim sName as String
sName = ThisWorkbook.Name
sName = Left(sName,len(sname)-4) & _
Format(now,"yyyymmdd_hh:mm:ss") & ".xls"
Thisworkbook.SavecopyAs sName
End Sub

TIA
Vaya con Dios,
Chuck, CABGx3


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Append DateTime to Fiename, saveCopy

Can you manually do a saveas with that name on that system?

Would it be better to use Thisworkbook.FullName



--
Regards,
Tom Ogilvy


"CLR" wrote:

Hi All...........

I'm having trouble with the following code in XL97/SR2.....getting "cant
find file" error and not making the copy.........could anybody tell me what's
wrong please?

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim sName as String
sName = ThisWorkbook.Name
sName = Left(sName,len(sname)-4) & _
Format(now,"yyyymmdd_hh:mm:ss") & ".xls"
Thisworkbook.SavecopyAs sName
End Sub

TIA
Vaya con Dios,
Chuck, CABGx3


  #3   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Append DateTime to Fiename, saveCopy

Hi Tom.......
No, I could not do a manual "save as" with that filename until I changed the
colon's in the time sequence to underscores........but still, it took your
"FullName" suggestion to make the whole thing work fine and save the new file
right back to the directory the original came from...........really, really
nice now......

Thank you very much.......

Vaya con Dios,
Chuck, CABGx3



"Tom Ogilvy" wrote:

Can you manually do a saveas with that name on that system?

Would it be better to use Thisworkbook.FullName



--
Regards,
Tom Ogilvy


"CLR" wrote:

Hi All...........

I'm having trouble with the following code in XL97/SR2.....getting "cant
find file" error and not making the copy.........could anybody tell me what's
wrong please?

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim sName as String
sName = ThisWorkbook.Name
sName = Left(sName,len(sname)-4) & _
Format(now,"yyyymmdd_hh:mm:ss") & ".xls"
Thisworkbook.SavecopyAs sName
End Sub

TIA
Vaya con Dios,
Chuck, CABGx3


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
Datetime CSV format kh[_2_] Excel Discussion (Misc queries) 1 November 13th 08 09:08 AM
autodate and datetime stamp DC Gringo Excel Worksheet Functions 1 December 3rd 04 06:25 PM
Date or datetime Dkso Excel Programming 1 December 2nd 03 08:25 PM
DateTime Format Joe Harriman Excel Programming 1 October 3rd 03 02:57 PM
datetime in query Ling[_2_] Excel Programming 1 August 8th 03 05:08 PM


All times are GMT +1. The time now is 04:25 AM.

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

About Us

"It's about Microsoft Excel"