Hello: I created a macro in MS Word. If I single step through it (Step Info), it does exactly what I want, as evident by the resulting changes in my Word document. However, if I press the Run button it does not appear to run , because I do not see the expected changes in my Word document. Help.
Thanks. Bill ----------------------------- My Code --------------------------- I am running the FitAllRegisterTables subroutine. Option Explicit Sub FitAllRegisterTables() Dim tbl As Table For Each tbl In ActiveDocument.Tables If LooksLikeRegisterTable(tbl) Then tbl.AutoFitBehavior (wdAutoFitContent) tbl.AutoFitBehavior (wdAutoFitWindow) End If Next tbl End Sub Function HeadingCell(tbl As Table, n As Integer) HeadingCell = Trim(tbl.Rows(1).Cells(n).Range) HeadingCell = Left$(HeadingCell, Len(HeadingCell) - 2) 'Drop the newline carriage-return. HeadingCell = Replace(HeadingCell, Chr$(160), Chr$(32)) 'Replace all nb-spaces with regular spaces. 'Debug.Print "HeadingCell:::" + HeadingCell + ":::" End Function Function LooksLikeFullTable(tbl As Table) LooksLikeFullTable = False If StrComp(HeadingCell(tbl, 1), "Reg") = 0 Then If StrComp(HeadingCell(tbl, 2), "Name") = 0 Then LooksLikeFullTable = True End If End If End Function Function LooksLikeDetailTable(tbl As Table) LooksLikeDetailTable = False If StrComp(HeadingCell(tbl, 1), "Bits") = 0 Then If StrComp(HeadingCell(tbl, 2), "Bit Name") = 0 Then LooksLikeDetailTable = True End If End If End Function Function LooksLikeRegisterTable(tbl As Table) LooksLikeRegisterTable = False If LooksLikeFullTable(tbl) Then LooksLikeRegisterTable = True ElseIf LooksLikeDetailTable(tbl) Then LooksLikeRegisterTable = True End If End Function -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at https://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout.