ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Activeworkbook.range --- Not supported by VBScript? (https://www.excelbanter.com/excel-programming/303261-activeworkbook-range-not-supported-vbscript.html)

Shetty

Activeworkbook.range --- Not supported by VBScript?
 
Hi all,
I have a small script running at each startup and shutdown.
At the runtime, it gives error that --- Object doesn't support this property or
method; 'Activeworkbook.range' <---
Any Help is appreciated.
Regards,
Shetty.

So far I have the following.

Dim objXL
Dim objWkB
Dim i
Dim Dr

Set objXL = wscript.CreateObject("Excel.Application")
objXL.Visible = False
Set objWkB = objXL.WorkBooks.Open("c:\123\time.xls")

objXL.activeworkbook.Range("A65536").End(xlUp).Off set(1, 0).select
objXL.activeworkbook.ActiveCell.Value = Date
objXL.activeworkbook.ActiveCell.Offset(0, 1).Value = Time

objXL.activeworkbook.save
objXL.activeworkbook.Close' Close WorkBook
objXL.Visible = True
objXL.Quit 'Quit Excel

papou[_9_]

Activeworkbook.range --- Not supported by VBScript?
 
Hi Shetty
Range is a property attached to an Excel sheet and not to a workbook.
So you may change with
objWkB.Worksheets("Sheet1").Range '....

HTH
Cordially
Pascal

"Shetty" a écrit dans le message de
m...
Hi all,
I have a small script running at each startup and shutdown.
At the runtime, it gives error that --- Object doesn't support this

property or
method; 'Activeworkbook.range' <---
Any Help is appreciated.
Regards,
Shetty.

So far I have the following.

Dim objXL
Dim objWkB
Dim i
Dim Dr

Set objXL = wscript.CreateObject("Excel.Application")
objXL.Visible = False
Set objWkB = objXL.WorkBooks.Open("c:\123\time.xls")

objXL.activeworkbook.Range("A65536").End(xlUp).Off set(1, 0).select
objXL.activeworkbook.ActiveCell.Value = Date
objXL.activeworkbook.ActiveCell.Offset(0, 1).Value = Time

objXL.activeworkbook.save
objXL.activeworkbook.Close' Close WorkBook
objXL.Visible = True
objXL.Quit 'Quit Excel





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com