Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Save Excel File every wednesday VB Script Help


Hello Group,
I use the following code to save file as an html at the end of month
with Date stamp.

Sub chem_gas_7day()
Dim newSecond
Dim fname As String

fname = Format(Date, "yyyy-mm")


Sheets("data").Select

If CDate(Format(Range("A2").Value, "mm/dd/yyyy")) =
CDate(DateSerial(Year(Now), Month(Now) + 1, 0)) Then


ActiveWorkbook.Save

ChDir "C:\TEST\"
ActiveWorkbook.SaveAs Filename:="C:\TEST\" & fname & "_Report" &
".html", FileFormat:=xlHtml, _
ReadOnlyRecommended:=False, CreateBackup:=False


Else

Sheets("Report").Select
Range("A1").Select

ActiveWorkbook.Save

ChDir "C:\TEST\"
ActiveWorkbook.SaveAs Filename:="C:\TEST\Report.html",
FileFormat:=xlHtml, _
ReadOnlyRecommended:=False, CreateBackup:=False



End If

End Sub


I wonder if i can save file now every Wednesday with Date stamp (file
name = wednesday date). In other words saving file every 7th day.
Thanks in adavnce for help.
Sam


--
sam76210
------------------------------------------------------------------------
sam76210's Profile: http://www.excelforum.com/member.php...o&userid=20885
View this thread: http://www.excelforum.com/showthread...hreadid=520215

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Save Excel File every wednesday VB Script Help

Sub chem_gas_7day()
Dim newSecond
Dim fname As String

fname = Format(Date, "yyyy-mm-dd")

Sheets("data").Select

If Weekday(Date) = 4 Then

ActiveWorkbook.Save
ChDir "C:\TEST\"
ActiveWorkbook.SaveAs Filename:="C:\TEST\" & fname & "_Report" &
".html", _
FileFormat:=xlHtml, _
ReadOnlyRecommended:=False, _
CreateBackup:=False

Else

Sheets("Report").Select
Range("A1").Select
ActiveWorkbook.Save
ChDir "C:\TEST\"
ActiveWorkbook.SaveAs Filename:="C:\TEST\Report.html", _
FileFormat:=xlHtml, _
ReadOnlyRecommended:=False, _
CreateBackup:=False

End If

End Sub

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"sam76210" wrote in
message ...

Hello Group,
I use the following code to save file as an html at the end of month
with Date stamp.

Sub chem_gas_7day()
Dim newSecond
Dim fname As String

fname = Format(Date, "yyyy-mm")


Sheets("data").Select

If CDate(Format(Range("A2").Value, "mm/dd/yyyy")) =
CDate(DateSerial(Year(Now), Month(Now) + 1, 0)) Then


ActiveWorkbook.Save

ChDir "C:\TEST\"
ActiveWorkbook.SaveAs Filename:="C:\TEST\" & fname & "_Report" &
".html", FileFormat:=xlHtml, _
ReadOnlyRecommended:=False, CreateBackup:=False


Else

Sheets("Report").Select
Range("A1").Select

ActiveWorkbook.Save

ChDir "C:\TEST\"
ActiveWorkbook.SaveAs Filename:="C:\TEST\Report.html",
FileFormat:=xlHtml, _
ReadOnlyRecommended:=False, CreateBackup:=False



End If

End Sub


I wonder if i can save file now every Wednesday with Date stamp (file
name = wednesday date). In other words saving file every 7th day.
Thanks in adavnce for help.
Sam


--
sam76210
------------------------------------------------------------------------
sam76210's Profile:

http://www.excelforum.com/member.php...o&userid=20885
View this thread: http://www.excelforum.com/showthread...hreadid=520215



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Save Excel File every wednesday VB Script Help


Thanks Bob( ). It works for me.
Regards
Sam


--
sam76210
------------------------------------------------------------------------
sam76210's Profile: http://www.excelforum.com/member.php...o&userid=20885
View this thread: http://www.excelforum.com/showthread...hreadid=520215

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
Excel 2007 Can't Save File with VB Script but it can in 97/2003format??? [email protected] Excel Discussion (Misc queries) 2 February 9th 09 03:38 PM
can't save VBA script when saving excel file thinktwice Excel Discussion (Misc queries) 5 December 27th 06 07:38 AM
Save Excel File every wednesday VB Script Help !! sam76210 Excel Discussion (Misc queries) 0 March 8th 06 04:05 PM
Script to save Excel file to the server. raj41977 Excel Discussion (Misc queries) 3 December 8th 05 02:48 PM
when i save xls file, debug script is running and canno't save fil Imtiaz Excel Discussion (Misc queries) 1 July 16th 05 03:47 PM


All times are GMT +1. The time now is 02:22 PM.

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"