How can I write a code that will save as the workbook with newworkbook and in a certain location
[vba]Sub SaveAs()
ActiveWorkbook.SaveAs ("New")
End Sub
[/vba]
How can I write a code that will save as the workbook with newworkbook and in a certain location
[vba]Sub SaveAs()
ActiveWorkbook.SaveAs ("New")
End Sub
[/vba]
T-ogether
E-veryone
A-chieves
M-ore
One who asks a question is a fool for five minutes; one who does not ask a question remains a fool forever.
Here's a start...I used the macro recorder to get this:
[VBA]Sub Macro1()
ChDir "C:\Documents and Settings\main\Desktop\temp"
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Dan&Stacy\Desktop\temp\Book1.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False
End Sub[/VBA]
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
There are special settings in this code, I use it for a text file and I assign it w/ a timestamp. All can be cut out if you don't need, I am just giving as an example.
[vba]
Dim sPath as String
Dim wb As Workbook
Dim ws?? As Worksheet
Set wb = Workbooks("yourworkbookname.xls")
Set wsEC = Worksheets("sheetname")
wb.Save
ws??.Activate
sPath = "C:\DocsandSetting\Desktop\My Documents\Excel\"
With ws??
.SaveAs Filename:=sPath & "yourworkbookname " & _
Format(Now, "m-dd-yy") & " @ " & Format(Now, "h_mm_ss am/pm") & ".txt", _
FileFormat:=xlTextMSDOS
End With
[/vba]
my site: www.ecboardco.com
was built w/ a majority of the assistance from the board members here... thanks VBAX.
Just because I see something, doesn't mean that what's actually happening is what I see.
You don't get from 0-90 by standing still!
Gotcha
T-ogether
E-veryone
A-chieves
M-ore
One who asks a question is a fool for five minutes; one who does not ask a question remains a fool forever.