Excel + WSH

I've got this macro in Excel:

Sub Macro3()

    ActiveWorkbook.SaveAs FileName:= _
        "C:\WINNT\Profiles\alexp.000\Personal\test.xls", FileFormat:=xlNormal, _
        Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
        CreateBackup:=False
End Sub

How can I convert this macro to Windows Sripting Host/ASP?  

objXL.ActiveWorkboost.Saveas works, but it doesnt save it with the filename I want... when I try to add the filename variable, it says incorrect syntax...

thanks!
ampxAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
kevinw1Connect With a Mentor Commented:
Did you create a workbook first?

    Dim oXL

    Set oXL = CreateObject("Excel.Application")

    oXL.Workbooks.Add
    oXL.ActiveWorkbook.SaveAs "C:\Data\Excel97\MyFile.xls"

    oXL.Quit

    Set oXL = Nothing

This little snippet worked fine for me. When I removed oXL.Workbooks.Add I do get an error.
0
 
ampxAuthor Commented:
Awesome... haha, I tried everything like

oXL.ActiveWorkbook.SaveAs Filename = "C:\Data\Excel97\MyFile.xls"

and a bunch of otherstuff, and it didn't work...  thanks for the tip, works great now...

   
0
 
kevinw1Commented:
Great! Thanks for the feedback!
0
All Courses

From novice to tech pro — start learning today.