Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Opening excel spreadsheet from within a VBscript

Andy wrote:
[b]I assume you really mean VBScript and not VBA, so here goes;

Here is a sample VBScript. Save it in a standard text file with a
.VBS
extention.
This one creates an Excel object, opens a workbook, sets a value,
runs a VBA
routine, then tides up and closes down.

Set xlObj = CreateObject("Excel.application")
xlObj.Workbooks.Open "C:\Byg\textfile\TextFileReformat.xls"
xlObj.Range("NoOfCharsPerLine").Value = 50
xlObj.Run "ReadFromTextFile"
xlObj.ActiveWorkbook.Saved = True
xlObj.ActiveWindow.Close
xlObj.Quit


[b]

Don't forget to
Set xlObj = Nothing

at the end......

Keith
www.kjtfs.com



---
Message posted from http://www.ExcelForum.com/

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
Opening more than 1 Excel Spreadsheet Catlady Excel Discussion (Misc queries) 4 March 2nd 07 11:49 PM
Can i include a vbscript file with an xml spreadsheet? Neil.Wills Excel Discussion (Misc queries) 0 September 1st 05 12:34 AM
Opening Excel spreadsheet in MAC Doug Excel Discussion (Misc queries) 2 June 26th 05 12:34 AM
Opening an excel spreadsheet Frustrated Excel Worksheet Functions 1 April 2nd 05 06:39 PM
VBScript Automation of Excel Spreadsheet Sorting & Filtering Tom Ogilvy Excel Programming 1 September 10th 03 03:01 PM


All times are GMT +1. The time now is 09:34 AM.

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

About Us

"It's about Microsoft Excel"