>Hi, all
> I use vb.net and write a export excel function. In first , i want to set the cell from A to F will be text format.
>But i don't know my below code can not , how can i do. Anyone can give some idea to me. Thank you~~~
>
>
>
> Dim Sheet As Excel.Worksheet
>Sheet.Columns("A:F").Select()
> Sheet.Selection.NumberFormatLocal = "@" 'In this will display error, worksheet no public member selection
>
>
"Selection" property is applied to Application or Window objects. See details in Excel VBA Help on "Selection" property.
So, it should be:
Sheet.Application.Selection.NumberFormatLocal = "@"
And probably you do not need to select anything. This also should work:
Sheet.Columns("A:F").NumberFormatLocal = "@"
Good Luck