Excel Wscript Selection Problem

R

Ralf Meuser

Hi there


I created a wscipt like this


....
Set objXL = WScript.CreateObject ("Excel.Application")
....
objWb7.Tab.ColorIndex = 7
Set objDanach =
objXL.ActiveWorkBook.WorkSheets(objXL.ActiveWorkBook.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
 
S

stefan onken

hi Ralf,
Selection refers to the Application and not to a Worksheet, so try
objXl instead of objWb8
for the Selection.

Gruß
stefan
 
R

Ralf Meuser

Hi Stefan

Thanks a lot

Now it works
Have a nice Week end
bye


Ralf
"stefan onken" <[email protected]> a écrit dans le message de (e-mail address removed)...
hi Ralf,
Selection refers to the Application and not to a Worksheet, so try
objXl instead of objWb8
for the Selection.

Gruß
stefan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Excel 2003 vbs script problem 2
Run Time Error 1004 2
Excel VBA Help 3

Top