Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-24-2017, 02:46 AM
lodi123 lodi123 is offline Problem with table grid when selecting status in ribbon Windows 7 32bit Problem with table grid when selecting status in ribbon Office 2010 32bit
Novice
Problem with table grid when selecting status in ribbon
 
Join Date: Feb 2017
Posts: 10
lodi123 is on a distinguished road
Default Problem with table grid when selecting status in ribbon

Hello,



I'm stuck with another problem. I hope you can help me!
So in my document I have a table with help text that says to select the right status (3 choices) in the custom ribbon.
In most cases, when selecting a status, this table disappears and the choosen status appears in a new table.
In some cases, I get an error message that says the fault lies with the Style = Table Grid.
Everytime I get this error, my Word window also says Compatibility Mode, even though it's the same Word version as in the non-error case.
Is this because in the compatibility mode, there is no such style as table grid?


Sub ApplyStandardWorkflow(Control As IRibbonControl)
With ActiveDocument
Dim oRng As Range

Set oRng = ActiveDocument.Tables(2).Rows(1).Cells(1).Range
oRng.End = oRng.End - 1 'to exclude the end of cell marker
oRng.Select
Selection.Tables(1).Select
Selection.Rows.Delete
Selection.TypeBackspace
Selection.TypeParagraph
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=1, NumColumns:= _
1, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed
With Selection.Tables(1)
If .Style <> "Table Grid" Then
.Style = "Table Grid"
End If
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = False
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = False
.ApplyStyleRowBands = True
.ApplyStyleColumnBands = False

End With

ActiveDocument.AttachedTemplate.BuildingBlockEntri es("StandardWorkflow").Insert _
Where:=Selection.Range, RichText:=True
Selection.Rows.Delete
Selection.TypeBackspace
Selection.Tables(1).AutoFitBehavior (wdAutoFitWindow)
End With
End Sub

Thank you!!
Reply With Quote
  #2  
Old 02-24-2017, 05:32 AM
gmayor's Avatar
gmayor gmayor is offline Problem with table grid when selecting status in ribbon Windows 10 Problem with table grid when selecting status in ribbon Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

What EXACTLY is this code supposed to achieve?
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
Reply

Tags
building block, table

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to make a table of contents in a grid rodrigocarballo Word 1 11-11-2016 01:32 PM
Making a grid with diagonal lines extending outside of table stulutions Publisher 0 09-21-2016 10:15 AM
Problem with table grid when selecting status in ribbon Selecting table cell vs. text dionnaro Word Tables 1 05-24-2016 04:04 PM
Problem when selecting a style in the styles list patricebrel Word 2 01-09-2016 06:52 AM
Problem with table grid when selecting status in ribbon Problem with ribbon customization NobodysPerfect Word 3 11-10-2014 12:49 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:11 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft