Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-08-2023, 02:59 AM
Jonast. Jonast. is offline How do I differentiate between two directories in Word VBA? Windows 11 How do I differentiate between two directories in Word VBA? Office 2021
Novice
How do I differentiate between two directories in Word VBA?
 
Join Date: Apr 2023
Posts: 1
Jonast. is on a distinguished road
Default How do I differentiate between two directories in Word VBA?

Hello everyone,




the following code is part of a longer macro:


Dim TOFRange As Range

Dim Found As Boolean

Set TOFRange = ActiveDocument.TablesOfFigures(1).Range

With TOFRange.Find

.ClearFormatting

.Font.Italic = True

.Font.Bold = True

.Text = ""

.Forward = True

.Wrap = wdFindStop

Do While .Execute

If Not TOFRange.InRange(ActiveDocument.TablesOfFigures(1) .Range) Then

Exit Do

End If

TOFRange.Font.Italic = False

TOFRange.Font.Bold = True

TOFRange.Collapse wdCollapseEnd
Loop

End With

This part formats a section of my table of figures.

My plan is to have the same functions for tables. Therefore, I have inserted a table of tables, which is also a TOF. Now my question is: How do I change the above code so that Word knows that I mean the table of tables and not the table of figures? I have already replaced the 1 behind TablesOfFigures with all numbers up to 9, but unfortunately this does not change anything.

Thank you and have a nice Easter weekend!

Regards, Jonas
Reply With Quote
  #2  
Old 04-08-2023, 08:46 AM
gmaxey gmaxey is offline How do I differentiate between two directories in Word VBA? Windows 10 How do I differentiate between two directories in Word VBA? Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

You really shouldn't cross post the same question in two groups without a reference to each post. I've already replied in the other forum and someone else could waste their time giving you the same answer here!!


Where did "9" come from? Replace the 1 in .TablesOfFigures(1) to 2 in both instances. Note, if all the text in the table of figures or table of tables is Bold\Italic then your macro won't find anything.
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
Reply

Tags
makro, tof



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I differentiate between two directories in Word VBA? Treversing directories and open WORD-docs ??? ksor Word VBA 0 10-14-2019 05:20 AM
How do I differentiate between two directories in Word VBA? Any Way for Find & Replace to Differentiate Between Left & Right Inverted Commas? CrossReach Word 2 12-08-2018 09:17 PM
How do I differentiate between two directories in Word VBA? control or differentiate between the text boundaries for whole page and the line itself Fatin Rimawi Word 2 01-14-2018 08:55 AM
I want a tutorial on what directories/files OneNote 2010/13 and Office 365 create stjudeb OneNote 0 04-10-2017 10:57 AM
Can you have 2 directories in 1 document? Beeblebrox Mail Merge 2 09-30-2013 08:35 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:08 AM.


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