View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Patrick Dave Patrick is offline
external usenet poster
 
Posts: 249
Default VBs scripting for calling excel sreadsheet

All air code but this should get you started.

Option Explicit
Dim filePath1, filePath1, oExcel, oSheet

filePath1 = "c:\Test.xlt"
filePath2 = "c:\Test1.xls"
Set oExcel = CreateObject("Excel.Application")
oExcel.Workbooks.Open(filepath1)
oExcel.Run "macro1"
oExcel.DisplayAlerts = False
oExcel.ActiveWorkbook.SaveAs filePath2
oExcel.Close(false, filePath1)
oExcel.Close(false, filePath2)
oExcel.Quit
Set oExcel = Nothing

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Patrick" wrote:
| Hi every1!!
|
| Not sure if this is the right section for this but here goes:
|
| I want to right a vbs script that will call an excel template i created.
| That template as an Auto_Open macros that needs to be executed.
|
| Then i want to save that excel under diff name and close it.
| All this needs to be invisible to user, so i dont need to visually see the
| excel spreadsheet open up and everything..
|
| Can this be done!!!
|
| Thx in advance for any help you can provide me with..
|
| PAtrick