troubleshooting Question

WrapText in Columns in Excel sheet via .net

Avatar of Fordraiders
FordraidersFlag for United States of America asked on
Visual Basic.NET
2 Comments1 Solution1662 ViewsLast Modified:
vb.net 2003
excel 2003

What I need:
Select Columns  G ang H
Format the Column to WrapText in the excel sheet

' current code from .net
XL.Visible = True 'open excel
        xlWB = XL.Workbooks.Open(xlPath) 'open the workbook
        xlWS = xlWB.Worksheets("GPS Worksheet") 'set the worksheet

        Dim SpecialChars As String = "!@#$%^&*()_+-={}|:<>?,[]./;"
        Dim Rng As Excel.Range
                ' delete special characters
        With xlWS
            Rng = XL.Intersect(.Range("A:A"), .UsedRange)
        End With
        For r As Integer = 1 To Rng.Rows.Count
            For c As Integer = 0 To SpecialChars.Length - 1
                Rng.Cells(r, 1).Value = Rng.Cells(r, 1).Value.ToString.Replace(SpecialChars.Chars(c), "")
            Next
        Next
        ' make the call to run
        xlWB.Application.Run(mcrName)
         '<-------------------  ' run the code to wraptext here...
Thanks
fordraiders
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros