# inserting a column in excel from vb6



## spumbu1977 (Jul 3, 2006)

hi all,

i am trying to add a column intoi my excel spreadsheet during my apps runtime

so far i have is the follwing

Dim Ex As Object
        Dim ws As Object
        Set Ex = CreateObject("Excel.Application")
        Ex.Workbooks.Add ("c:\text.xls")

        Set ws = Ex.Worksheets(1)

        ws.Range("f3").Select
        ws.Selection.EntireColumn.Insert


        Ex.Visible = True

but it tells me object not supported on the folowing line : ws.Selection.EntireColumn.Insert

anyone have any ideas 

thanks in advance
ROb


----------



## Zack Barresse (Jul 3, 2006)

Hi Rob,

How about something like this ...



New postPosted: Mon Jul 03, 2006 12:55 pm    Post subject: inserting a column in excel from vb6 	Reply with quote Edit/Delete this post Delete this post View IP address of poster Report Post
hi all,

i am trying to add a column intoi my excel spreadsheet during my apps runtime

so far i have is the follwing


```
Dim Ex As Object, wb As Object, ws As Object
Set Ex = CreateObject("Excel.Application")
Set wb = Ex.Workbooks.Add
Set ws = wb.Worksheets(1)
ws.Range("f3").EntireColumn.Insert
Ex.Visible = True
```

Also, can you not set a reference to the Excel Object Library in your project?


----------

