[英]How to set Wordwrap in Excel using vb.net
I have looked at the solutions offered and have tried them with no luck.我查看了提供的解决方案并尝试了它们,但没有成功。 I feel I am missing something.我觉得我错过了什么。 I get the following error "Public member 'wordwrap' on type 'Worksheet' not found"我收到以下错误“未找到类型 'Worksheet' 上的公共成员 'wordwrap'”
Thanks in advance.提前致谢。
Here is part of the code.这是代码的一部分。
Dim oExcel As Object
Dim oBook As Object
Dim oSheet1 As Object
oExcel = CreateObject("Excel.Application")
oBook = oExcel.workbooks.add
oSheet1 = oBook.Worksheets(1)
oSheet1.name = "ProjectPlan"
oSheet1.Select
oSheet1.Columns("C:C").Select
With oSheet1
.wordwrap = True
End With
Use:利用:
Sheet.UsedRange.WrapText = True
In your case:在你的情况下:
Sheet.Columns("C:C").WrapText = True
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.