Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Using MyValue in SaveAs Fname

I have the following:
-----------
' Input the Mont End date in Column E

Range("E1").Select

Dim Message, Title, Default, MyValue

Message = "Enter MonthEnd date i.e. 31/01/2006 or 28/02/2006" ' Set
prompt.
Title = "Input Box" ' Set title.
Default = "31/01/2007" ' Set default.

' Display message, title, and default value.
MyValue = InputBox(Message, Title, Default)

ActiveCell.FormulaR1C1 = MyValue

Selection.Copy
ActiveCell.Offset(0, -1).Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Range("A1").Select
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Application.CutCopyMode = False

Range("A1").Select
--------------------------------
I would like to now save the worksheet as CSV using the above MyValue date
as part of the fixed filename such as:
if MyValue is 30/06/2007 the filename should be "diur0607.csv"
and the file should be saved in this path: //cav-new/files
========
thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Using MyValue in SaveAs Fname

Dim myFilename As String
myFilename = "diur" & Format(DateValue(myValue), "mmyy") & ".csv"
ActiveWorkbook.SaveAs Filename:= _
\\cav-new\files\ & myFilename, _
FileFormat:=xlCSV

HTH,
Bernie
MS Excel MVP


"Helmut" wrote in message
...
I have the following:
-----------
' Input the Mont End date in Column E

Range("E1").Select

Dim Message, Title, Default, MyValue

Message = "Enter MonthEnd date i.e. 31/01/2006 or 28/02/2006" ' Set
prompt.
Title = "Input Box" ' Set title.
Default = "31/01/2007" ' Set default.

' Display message, title, and default value.
MyValue = InputBox(Message, Title, Default)

ActiveCell.FormulaR1C1 = MyValue

Selection.Copy
ActiveCell.Offset(0, -1).Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Range("A1").Select
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Application.CutCopyMode = False

Range("A1").Select
--------------------------------
I would like to now save the worksheet as CSV using the above MyValue date
as part of the fixed filename such as:
if MyValue is 30/06/2007 the filename should be "diur0607.csv"
and the file should be saved in this path: //cav-new/files
========
thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Using MyValue in SaveAs Fname

Hi Helmut,

Perhaps this would work:

ActiveWorkbook.SaveAs filename:="\\cav-new\files\diur" & mid(myvalue,
4,2)& right(myvalue,2) & ".csv",FileFormat:=xlCSV

assuming cav-new is a network share and the date is entered as dd/mm/
yyyy

Cheers
David


On Jul 3, 10:10 pm, Helmut wrote:
I have the following:
-----------
' Input the Mont End date in Column E

Range("E1").Select

Dim Message, Title, Default, MyValue

Message = "Enter MonthEnd date i.e. 31/01/2006 or 28/02/2006" ' Set
prompt.
Title = "Input Box" ' Set title.
Default = "31/01/2007" ' Set default.

' Display message, title, and default value.
MyValue = InputBox(Message, Title, Default)

ActiveCell.FormulaR1C1 = MyValue

Selection.Copy
ActiveCell.Offset(0, -1).Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Range("A1").Select
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Application.CutCopyMode = False

Range("A1").Select
--------------------------------
I would like to now save the worksheet as CSV using the above MyValue date
as part of the fixed filename such as:
if MyValue is 30/06/2007 the filename should be "diur0607.csv"
and the file should be saved in this path: //cav-new/files
========
thanks


activesheet.saveas name:="//cav-new/files/diur" & month(myValue) &
year(myValue) & ".csv"

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Using MyValue in SaveAs Fname

Sorry,

The path should be in double quotes - "\ \ cav-new \ files \ " (Without the spaces, used to keep
the autoconversion in check....)

HTH,
Bernie
MS Excel MVP


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Dim myFilename As String
myFilename = "diur" & Format(DateValue(myValue), "mmyy") & ".csv"
ActiveWorkbook.SaveAs Filename:= _
\\cav-new\files\ & myFilename, _
FileFormat:=xlCSV

HTH,
Bernie
MS Excel MVP


"Helmut" wrote in message
...
I have the following:
-----------
' Input the Mont End date in Column E

Range("E1").Select

Dim Message, Title, Default, MyValue

Message = "Enter MonthEnd date i.e. 31/01/2006 or 28/02/2006" ' Set
prompt.
Title = "Input Box" ' Set title.
Default = "31/01/2007" ' Set default.

' Display message, title, and default value.
MyValue = InputBox(Message, Title, Default)

ActiveCell.FormulaR1C1 = MyValue

Selection.Copy
ActiveCell.Offset(0, -1).Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Range("A1").Select
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Application.CutCopyMode = False

Range("A1").Select
--------------------------------
I would like to now save the worksheet as CSV using the above MyValue date
as part of the fixed filename such as:
if MyValue is 30/06/2007 the filename should be "diur0607.csv"
and the file should be saved in this path: //cav-new/files
========
thanks





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
Create user id fm LName, FName sjs Excel Worksheet Functions 3 July 1st 08 08:26 PM
change lname, fname to fname last name Al Wills Excel Discussion (Misc queries) 4 June 6th 05 06:18 AM
how do i reference data in a file with the fname in another cell? jhlrtn Excel Worksheet Functions 1 May 23rd 05 11:11 PM
MyValue StephanieH Excel Programming 3 October 27th 04 10:14 PM
How to separate fname and fname in cell in excel Excel Problem Excel Programming 2 June 27th 04 01:37 PM


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