Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Saving a file from a command button with user input

'Try This...

Sub SaveName()

Dim strPath As String
Dim strFile As String
Dim strDate As String

strPath = "C:\Temp"
strFile = Sheet1.Range("I3")
strDate = Format(Now(), "mm-dd-yyyy")

ActiveWorkbook.SaveAs FileName:=strPath & "\" & strFile &
strDate & ".xls"


End Sub



-----Original Message-----
An easy one for excel experts!

1. I need to save a file from a command button with the

current date attached at the end? Command Button is
written part is already complete.
2. I would like the name the file to be entered into a

cell, say I3. I want the button to use the name in the
cell, (I3), and then add the date proir to saving the
file.

Can any one help!


.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Saving a file from a command button with user input

Owen: Not working: Let me show you what I have: First part is no longer being used
'Dim pname As String
'Dim fname As String
'pname = "C:\Network_2000\Current_Projects\"
'fname = Worksheets("General info").Range("C47").Value & "#" & Range("I3").Value
'fname = "" 'this is to set the value to null'
'fname = Worksheets("Road Editor").Range("I3").Value
'& Format(Now, "mm-dd-yyyy")
'ActiveWorkbook.SaveAs Filename:="" & pname & fname & ""

Dim strPath As String
Dim strFile As String
Dim strDate As String

'path exists
strPath = "C:\Network_2000\Current_Projects"
strFile = Sheet1.Range("I3")
' returns correct value from the cell'
strDate = Format(Now, "mm-dd-yyyy")
'returns correct date
'ActiveWorkbook.SaveAs Filename:="" & strPath & strFile & strDate
'ActiveWorkbook.SaveAs Filename:="" & strPath & strFile & strDate & ""
ActiveWorkbook.SaveAs Filename:=strPath & "\" & strFile & strDate & ".xls"
'this last line above will not complile, still yellow color.

As you can see, I have tried several different approaches, I still cannot get it to work! I have included everything. I used the ' to eliminate the old code as it were.
Can you see the problem? Please help!

"Owen" wrote:

'Try This...

Sub SaveName()

Dim strPath As String
Dim strFile As String
Dim strDate As String

strPath = "C:\Temp"
strFile = Sheet1.Range("I3")
strDate = Format(Now(), "mm-dd-yyyy")

ActiveWorkbook.SaveAs FileName:=strPath & "\" & strFile &
strDate & ".xls"


End Sub



-----Original Message-----
An easy one for excel experts!

1. I need to save a file from a command button with the

current date attached at the end? Command Button is
written part is already complete.
2. I would like the name the file to be entered into a

cell, say I3. I want the button to use the name in the
cell, (I3), and then add the date proir to saving the
file.

Can any one help!


.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Saving a file from a command button with user input

I'm not sure what to say...I tested the code I sent you in
a blank workbook and it compiled fine. My guess is the
path you defined, or the filename your specifying is not
valid. You may want to try recording a macro using
the 'save as' function to verify the path is correct.
HTH


-----Original Message-----
Owen: Not working: Let me show you what I have: First

part is no longer being used
'Dim pname As String
'Dim fname As String
'pname = "C:\Network_2000\Current_Projects\"
'fname = Worksheets("General info").Range

("C47").Value & "#" & Range("I3").Value
'fname = "" 'this is to set the value to null'
'fname = Worksheets("Road Editor").Range("I3").Value
'& Format(Now, "mm-dd-yyyy")
'ActiveWorkbook.SaveAs Filename:="" & pname & fname

& ""

Dim strPath As String
Dim strFile As String
Dim strDate As String

'path exists
strPath = "C:\Network_2000\Current_Projects"
strFile = Sheet1.Range("I3")
' returns correct value from the cell'
strDate = Format(Now, "mm-dd-yyyy")
'returns correct date
'ActiveWorkbook.SaveAs Filename:="" & strPath &

strFile & strDate
'ActiveWorkbook.SaveAs Filename:="" & strPath &

strFile & strDate & ""
ActiveWorkbook.SaveAs Filename:=strPath & "\" &

strFile & strDate & ".xls"
'this last line above will not complile, still yellow

color.

As you can see, I have tried several different

approaches, I still cannot get it to work! I have included
everything. I used the ' to eliminate the old code as it
were.
Can you see the problem? Please help!

"Owen" wrote:

'Try This...

Sub SaveName()

Dim strPath As String
Dim strFile As String
Dim strDate As String

strPath = "C:\Temp"
strFile = Sheet1.Range("I3")
strDate = Format(Now(), "mm-dd-yyyy")

ActiveWorkbook.SaveAs FileName:=strPath & "\" & strFile

&
strDate & ".xls"


End Sub



-----Original Message-----
An easy one for excel experts!

1. I need to save a file from a command button with

the
current date attached at the end? Command Button is
written part is already complete.
2. I would like the name the file to be entered into a

cell, say I3. I want the button to use the name in the
cell, (I3), and then add the date proir to saving the
file.

Can any one help!


.


.

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
User form and Command button Marilyn Excel Discussion (Misc queries) 3 May 9th 07 12:50 AM
Trouble with saving user input in an Excel Form. University of Maine student Excel Discussion (Misc queries) 0 March 14th 06 07:31 PM
Command Button on User form for Printing Anthony Slater Excel Discussion (Misc queries) 2 September 7th 05 02:01 PM
Open an Outlook folder when a user clicks on a command button ... Rob Keel Excel Discussion (Misc queries) 2 August 1st 05 08:23 AM
User defined file name in an OpenText File command surveyorinva Excel Programming 1 June 8th 04 06:40 PM


All times are GMT +1. The time now is 11:27 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"