Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.newusers,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Save Location - Date Format




Hello all

This is how my button is programmed...

----------------------------------------------------------------------
------
----------------------------------------------------------------------
------
----------------------------


Private Sub UserForm_Initialize()
Me.TextBox1.Text = Date
End Sub

Private Sub CommandButton1_Click()
MyPath = "\\tprc1fanp001\shared\Enforcement, Enquiry &
Complaints\Manual
Payment History\" 'Set the Path
MyFileName = "Date" & Me.TextBox1.Text & ".xls" 'Create the
File Name
MySaveString = MyPath & MyFileName 'String the two together

ActiveWorkbook.SaveAs Filename:=MySaveString, FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub

----------------------------------------------------------------------
------
----------------------------------------------------------------------
------
----------------------------
This is my error message:



Run Time Error '1004':
Microsoft Excel cannot access the file
'\\tprc1fanp001\shared\Enforcement,
Enquiry & Complaints\Manual Payment History\Date06\02' There are
several
possible reasons:
-The file name or path name does not exist
-The file you're trying to open is being used by another program.

Close the document in the other program, and try again

End or Debug


I was advised:

Hyphens and underscores are valid. Underscores get hidden if hyperlinks
are involved. But would certainly suggest using four digit year and
placing year before month before day of month, so you can sort
on filename when looking at a directory. i.e.
format(now(),"yyyy-mm-dd") -or-
format(now(),"yyyy_mmdd")

But where do I put format(now(),"yyyy-mm-dd") ?

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Save Location - Date Format

Ravi


MyFileName = "Date" & Me.TextBox1.Text & ".xls" 'Create the
File Name


MyFileName = "Date" & Format(Me.TextBox.Text, "yyyy-mm-dd") & ".xls"

Please post to only one group.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.



  #3   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.newusers,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15
Default Save Location - Date Format

[posted and mailed]

"Ravi Sandhu" wrote in news:dalWb.9486$q%6.2865826
@newsfep2-win.server.ntli.net:

Microsoft Excel cannot access the file
'\\tprc1fanp001\shared\Enforcement,
Enquiry & Complaints\Manual Payment History\Date06\02' There are


Your problem is that you are using the character "/" in the filename (it's
part of the date). This is an invalid character in a Windows filename.

Windows interprets the / as the end of the filename.

You have to replace the / with some other character (like -) in order for
it to work like you expect.


--
My email address has an extra @ (spell it out) and an extra invalid. Please
remove them if you are not a spammer or list broker and want to reply.
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
SAVE AS CSV, KEEP DATE FORMAT clau Excel Worksheet Functions 3 April 3rd 23 06:42 PM
Date format won't save...? Erin[_2_] Excel Worksheet Functions 4 December 18th 08 02:48 PM
Macro - save to current location vs excel default location leezard Excel Discussion (Misc queries) 0 October 28th 08 03:04 PM
date format changes when I save to CSV via a macro John Taylor Excel Discussion (Misc queries) 4 May 16th 07 01:44 PM
How to set date format between different location? claude Excel Worksheet Functions 4 February 8th 07 02:49 PM


All times are GMT +1. The time now is 10:50 AM.

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"