Results 1 to 5 of 5
  1. #1
    Raddle is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2021
    Posts
    60

    Loop through excel tables turning on wrap text

    Can anyone help with how to select all tables in a workbook and apply wraptext ?
    I am guessing that wrap text is a cell property not a table property because when I add a like like tbl.wraptext=true it errors.

    However how do I 'select' the table range and then apply this?

    Hints very welcome.

    Sub Acnt_FormatTableStyle() 'format the table
    Dim tbl As ListObject
    Dim ws As Worksheet

    For Each ws In ActiveWorkbook.Sheets

    For Each tbl In ws.ListObjects


    Debug.Print tbl.name

    tbl.TableStyle = "TableStyleMedium9"
    tbl.ShowAutoFilterDropDown = False
    Next tbl

    Next ws
    End Sub

  2. #2
    Raddle is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2021
    Posts
    60
    Urgh ...

    didn't deserve any replies did it .. apols

    ActiveSheet.ListObjects(1).Range.Select

    With Selection ' I had previously had .interior here which was stopping it from acting on the cells (I guess)


    .Pattern = xlNone
    .TintAndShade = 0
    .PatternTintAndShade = 0
    .ShowAutoFilterDropDown = False
    .WrapText = True

    End With

  3. #3
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    You only allowed 11 minutes before posting again?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    Raddle is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2021
    Posts
    60
    Apols I thought that not wasting folk's time if I made progress was encouraged.
    noted.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 10-24-2023, 06:40 AM
  2. How do I get tables to wrap text?
    By lccrews in forum Access
    Replies: 5
    Last Post: 12-01-2017, 03:03 PM
  3. Wrap Text in report
    By waqas in forum Reports
    Replies: 1
    Last Post: 06-27-2012, 09:31 AM
  4. Wrap text conditionally
    By devcon in forum Reports
    Replies: 6
    Last Post: 06-12-2012, 12:32 AM
  5. wrap text
    By kamolrat in forum Reports
    Replies: 1
    Last Post: 11-17-2009, 01:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums