![]() |
Excel Wscript Selection Problem
Hi there
I created a wscipt like this .... Set objXL = WScript.CreateObject ("Excel.Application") .... objWb7.Tab.ColorIndex = 7 Set objDanach = objXL.ActiveWorkBook.WorkSheets(objXL.ActiveWorkBo ok.Worksheets.Count) Set objWb8 = objXL.ActiveWorkBook.WorkSheets.Add(,objDanach) objWb8.Name = "KPI4-7" objWb8.Tab.ColorIndex = 8 .... objWb8.Cells(lig,1) = "HAPPY TEST" objWb8.Columns("A:A").ColumnWidth = 3.9 objWb8.Range("A3:A12").Select objWb8.Selection.Orientation = 90 objWb8.Selection.VerticalAlignment = xlCenter objWb8.Selection.Interior.ColorIndex = 34 Every thing works fine. Only the 3 last Selection lines don't work. What is wrong? Thanks in davance for your help Best regards Ralf |
Excel Wscript Selection Problem
hi Ralf,
Selection refers to the Application and not to a Worksheet, so try objXl instead of objWb8 for the Selection. Gruß stefan On 23 Mai, 11:59, "Ralf Meuser" wrote: Hi there I created a wscipt like this ... Set objXL = WScript.CreateObject ("Excel.Application") ... objWb7.Tab.ColorIndex = 7 Set objDanach = objXL.ActiveWorkBook.WorkSheets(objXL.ActiveWorkBo ok.Worksheets.Count) Set objWb8 = objXL.ActiveWorkBook.WorkSheets.Add(,objDanach) objWb8.Name = "KPI4-7" objWb8.Tab.ColorIndex = 8 ... objWb8.Cells(lig,1) = "HAPPY TEST" objWb8.Columns("A:A").ColumnWidth = 3.9 objWb8.Range("A3:A12").Select objWb8.Selection.Orientation = 90 objWb8.Selection.VerticalAlignment = xlCenter objWb8.Selection.Interior.ColorIndex = 34 Every thing works fine. Only the 3 last Selection lines don't work. What is wrong? Thanks in davance for your help Best regards Ralf |
All times are GMT +1. The time now is 08:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com