"Public member on xlToRight' on type Range not found" error

I am attempting to insert a column in an Excel spreadsheet via automation from vb.net. I keep getting "Public member on xlToRight' on type Range not found"  when executing the attached code from the vb.net interface


excelSheet.Insert(Shift:=excelSheet.Range("B:B").xlToRight)

Open in new window

Juan VelasquezAsked:
Who is Participating?
 
Saurabh Singh TeotiaCommented:
Like i said, even if you do this...
 excelApp.Range("B:B").Insert
It will still be the same.
Saurabh...
0
 
Saurabh Singh TeotiaCommented:
I dont think that you need to give that command at all because whenever you insert columns in excel by default it shift them to right so even if you dont give the command its good to go.
Saurabh
0
 
Juan VelasquezAuthor Commented:
I found the problem.  I came up with
 excelApp.Range("B:B").Insert(Excel.XlDirection.xlToRight)
It was just a matter of syntax
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.