kaj10
08-01-2008, 03:48 PM
Sorry i should have named my thread better. Im a newbie and it is showing. I am an intern and am majoring in ISYS up until a couple of weeks ago I didnt know excel had VB capabilites but that is the language i am dealing with. I'm really interested in learning this new language so lets jump into my problem. I need to copy two worksheets in my workbook then save them to the network with a new name, but not just any new name, it needs to be formatted like this RG_BU0801RQ where RG_ is constant BU can also be ww, ro, and ca. 08 is the year 01 is the version # and RQ is constant. This is really giving me fits and I really appreciate any help.
Here is the code i already have and the only problem im having is with the file name.:beerchug: I have Excel 97
Dim sh As Worksheet
Dim shName As String
Dim strDate As Date
Dim x As String
'make copies of the request and report sheets
Sheets("Report").Select
Sheets("Report").Copy Before:=Sheets(3)
Sheets("Request").Select
Sheets("Request").Copy Before:=Sheets(2)
'Save copies as The new name and email to Admin
strDate = Format(Date, "yy")
shName = RG_ + " - " + strDate + " - " + REQ
ActiveWorkbook.SaveAs FileName:="s:\RG trials\trials\shname"
'Delete copies in the work book
Sheets("Request (2)").Select
ActiveWindow.SelectedSheets.Delete
Sheets("Report (2)").Select
ActiveWindow.SelectedSheets.Delete
Here is the code i already have and the only problem im having is with the file name.:beerchug: I have Excel 97
Dim sh As Worksheet
Dim shName As String
Dim strDate As Date
Dim x As String
'make copies of the request and report sheets
Sheets("Report").Select
Sheets("Report").Copy Before:=Sheets(3)
Sheets("Request").Select
Sheets("Request").Copy Before:=Sheets(2)
'Save copies as The new name and email to Admin
strDate = Format(Date, "yy")
shName = RG_ + " - " + strDate + " - " + REQ
ActiveWorkbook.SaveAs FileName:="s:\RG trials\trials\shname"
'Delete copies in the work book
Sheets("Request (2)").Select
ActiveWindow.SelectedSheets.Delete
Sheets("Report (2)").Select
ActiveWindow.SelectedSheets.Delete