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 in location button

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

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

Why is file attempting to save as Date06\02?

Thank you in advanced



  #2   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.newusers,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,718
Default Save in location button

A slash is not a valid file name character. I'd suggest you generate the
date string with something like this:

format(now,"ddmmyy")

--
Jim Rech
Excel MVP


  #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: 691
Default Save in location button

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")
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Jim Rech" wrote in message ...
A slash is not a valid file name character. I'd suggest you generate the
date string with something like this:

format(now,"ddmmyy")




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
Macro - save to current location vs excel default location leezard Excel Discussion (Misc queries) 0 October 28th 08 03:04 PM
how to get disk icon on save button of save as dialog like 2000 RichT Excel Discussion (Misc queries) 2 March 9th 06 08:13 PM
Button Error - Save at location Ravi Sandhu Excel Programming 2 February 5th 04 10:17 PM
Button - Save Location Ravi Sandhu Excel Programming 0 February 3rd 04 10:07 PM
Location of control button Thomas Tremain Excel Programming 7 November 25th 03 04:33 AM


All times are GMT +1. The time now is 04:14 PM.

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"