LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default add three parts of text with one date into a string


Hi to all!

i have written a programme in VBA, which will do following tusk whe
someone press the button

save the current page to new excel file with current date and curren
month, with others fixed formate which will add before or end of th
date or month and repleace the previous file.

format is RM-1 (current date like 13-11-04 or current month lik
Nov-04) somke text .xls

i want to give a file name with following format:

(text+ space + (current date or current month) + text)

the current date and current month should be change according to syste
date. and then only this function will continue forever.
the problem is i can't join the whole string and put them along wit
the date variable.

here are the code which i have made it.
------
ActiveWorkbook.Save

Dim rmmth As Date


rmmth = Date
rmmth1 = Format$(rmmth, "dd-mm-yy")
rmmth2 = Format$(rmmth, "mmm-yy")
rmmth3 = Format$(rmmth, "mmm")

day1 = Day(rmmth)

'f1 = "rm -"
'f2 = ""
'f3 = ".xls"
'Dim fname1 As String
'fname1 = (f1 + f2 + day1 + f3)

fname1 = "RM-1 30-11-04.xls"



If Format(rmmth, "mmm") = "Jan" Or Format(rmmth, "mmm") = "Feb" O
Format(rmmth, "mmm") = "Mar" Or Format(rmmth, "mmm") = "Apr" O
Format(rmmth, "mmm") = "May" Or Format(rmmth, "mmm") = "Jun" O
Format(rmmth, "mmm") = "Jul" Or Format(rmmth, "mmm") = "Aug" O
Format(rmmth, "mmm") = "Sep" Or Format(rmmth, "mmm") = "Oct" O
Format(rmmth, "mmm") = "Nov" Or Format(rmmth, "mmm") = "Dec" Then

ChDir "D:\"
ActiveWorkbook.SaveAs Filename:=fname1, FileFormat:=xlExcel9795, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False
_
CreateBackup:=False


Workbooks.Open Filename:="\\SS\ss_d\HOTEL HOST INTL. ROOM BIL
FORMAT\ROOM BILLS FORMAT IN EXCEL\all room bill 1 to 6.xls"

Windows("RM-1 13-11-04.xls").Activate
ActiveWorkbook.Save
ActiveWorkbook.Close
Windows("all room bill 1 to 6.xls").Activate
ActiveWindow.WindowState = xlMaximized


End If
--------------------

you can see that i have make a manuall format with date, but i want t
make it automaticaly, which ever month it is it will take that mont
and use that month along with fixed text formate and save it and sam
will happen with daily basis also.

i need your help, can any one help me with any clue or suggession o
bit of code, so that 'fname' will change automaticaly according t
current date and month.

thanks in advance

--
sujata_ghos
-----------------------------------------------------------------------
sujata_ghosh's Profile: http://www.excelforum.com/member.php...fo&userid=1643
View this thread: http://www.excelforum.com/showthread.php?threadid=27797

 
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
Date in Text String AMH Excel Worksheet Functions 1 June 30th 08 03:39 PM
Date format in a text string osbornauto Excel Worksheet Functions 15 July 3rd 07 09:06 PM
Extract certain parts of string djDaemon Excel Worksheet Functions 3 February 2nd 06 07:42 PM
Extract certain parts of string djDaemon Excel Worksheet Functions 0 February 2nd 06 03:31 PM
How do I convert a text string into a date? JJMCDD02 Excel Worksheet Functions 4 November 25th 05 12:35 PM


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