Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > VBScript
|
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old August 13th, 2008, 06:41 AM
Authorized User
 
Join Date: Mar 2008
Posts: 74
Thanks: 2
Thanked 0 Times in 0 Posts
Send a message via ICQ to sektor
Default Open Excel Spreadsheet

I got the following code. The workbook isn't opened.


Option Explicit

Dim objExcel
Dim objWorkbook

Set objExcel = WScript.CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\Scripts\New_users.xls" )

Set objExcel = Nothing
Set objWorkbook = Nothing


Reply With Quote
  #2 (permalink)  
Old June 28th, 2010, 11:13 PM
Authorized User
 
Join Date: May 2010
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Would this work for you? You would not be limited to opening only XLS Files, but also DOC, PDF, TXT, MP3, EXE, etc:
Code:
Dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")

'WScript.Echo "The next line of code runs the file."
objShell.Run "C:\Scripts\New_users.xls", 5, True

'WScript.Echo "The next line of code destroys the object."
Set objShell = Nothing
More details on the Run Method can be found here:
http://msdn.microsoft.com/en-us/libr...ky(VS.85).aspx

Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Spreadsheet Help SteveV VBScript 0 October 10th, 2006 04:42 PM
Excel Spreadsheet Help SteveV BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 0 October 10th, 2006 04:41 PM
Excel Spreadsheet Help SteveV BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 0 October 10th, 2006 04:40 PM
Excel Spreadsheet Manipulation Ryno Beginning VB 6 0 February 24th, 2005 02:16 AM
Embedding Excel Spreadsheet in C# Hitesh_Golyan C# 1 December 2nd, 2004 09:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.