Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 160
Default VBs scripting for calling excel sreadsheet

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default VBs scripting for calling excel sreadsheet


Set oWB = workbooks.open Filename:=name_of_file
Application.Run "'" & oWb.Name & "'!Auto_Open"
oWb.Close SaveChanges:=False
Set oWB = Nothing

--
HTH

Bob Phillips

"Patrick" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 160
Default VBs scripting for calling excel sreadsheet

This is great everything is working now.

Thank you so much!!

"Dave Patrick" wrote:

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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default VBs scripting for calling excel sreadsheet

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

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
changes to sreadsheet that changes other sheets in same doc auto adam New Users to Excel 1 July 14th 09 06:00 PM
Selecting Random Records From an Excel Sreadsheet Trevor Aiston[_2_] Excel Worksheet Functions 3 June 29th 09 11:20 AM
When I open an excel sreadsheet I have to x out twice. Why? Tony R Excel Discussion (Misc queries) 0 March 17th 08 06:54 PM
Open a .xls in micrsoft works sreadsheet Claire Excel Discussion (Misc queries) 2 February 18th 05 11:45 PM
is excel by itself enough to do scripting? gee at excel Excel Programming 1 October 14th 04 09:03 PM


All times are GMT +1. The time now is 08:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"