VBs scripting for calling excel sreadsheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Set oWB = workbooks.open Filename:=name_of_file
Application.Run "'" & oWb.Name & "'!Auto_Open"
oWb.Close SaveChanges:=False
Set oWB = Nothing
 
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

:
| 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
 
Glad to hear it. You're welcome.

--
Regards,

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

:
| This is great everything is working now.
|
| Thank you so much!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top