ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Save Excel File every wednesday VB Script Help !! (https://www.excelbanter.com/excel-discussion-misc-queries/75921-save-excel-file-every-wednesday-vbulletin-script-help.html)

sam76210

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=520145



All times are GMT +1. The time now is 07:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com