VBScript: Excel read file, update and save file issue
- From: rlessor@xxxxxxxxxxxxxx
- Date: Sat, 25 Aug 2007 06:16:43 -0700
VBScript: Missing the obvious?
I am trying to read an Excel file, update a column, and save the file
with the changes. My code (see example below) does update the columns
OK but I am having issues with the save and Excel close option. If I
open the file after process the script I get prompted the file is
already open and whether I want to reopen the spreadsheet. My true
needs are to update the Excel file and save to the original file while
closing everything at the conclusion of the operation. What am I
missing?
******** Example Code
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open ("C:\ActiveDirectoryVBScripts
\test.xls")
intRow = 1
strDN = ""
Do Until objExcel.Cells(intRow,1).Value = ""
objExcel.Cells(intRow,2).Value = intRow
intRow = intRow + 1
Loop
objExcel.Save "C:\ActiveDirectoryVBScripts\test.xls"
objExcel.Quit
wscript.echo "Excel Update Routine Completed Normally"
.
- Follow-Ups:
- Re: VBScript: Excel read file, update and save file issue
- From: Richard Mueller [MVP]
- Re: VBScript: Excel read file, update and save file issue
- Prev by Date: Re: Destroying Objects in VBScript
- Next by Date: VBScript - Get user's mailbox email address
- Previous by thread: delete cfirefox cache programitically
- Next by thread: Re: VBScript: Excel read file, update and save file issue
- Index(es):
Relevant Pages
|