Skip to main content
Question

Hello, I would like to know how can I do wrap text for all sheet

  • March 28, 2022
  • 1 reply
  • 39 views

Hello, I would like to know how can I do wrap text for all sheet

1 reply

Ashwin A.K
Forum|alt.badge.img+10
  • Navigator | Tier 3
  • March 28, 2022

Hi @ahmed belal​ ,

 

Could you give this a try?

 

Set xlObj = CreateObject("Excel.Application")

xlObj.visible = False

 

'Filepath goes in here

Set xlFile = xlObj.Workbooks.open(WScript.Arguments.Item(0))

 

'Section which performs the wordwrapping

For Each wk In xlFile.Sheets

  wk.Cells.WrapText = True

Next

 

xlObj.ActiveSheet.Range("A1").Select

 

xlFile.Save

xlFile.Close

xlObj.Quit

 

Kind Regards,

Ashwin A.K