Thread: [Solved] VBA IF Statement Help
View Single Post
 
Old 03-20-2024, 01:09 AM
Shelley Lou Shelley Lou is offline Windows 10 Office 2016
Expert
 
Join Date: Dec 2020
Posts: 259
Shelley Lou is on a distinguished road
Default VBA IF Statement Help

Hi Greg, I've tested the code and yes it works if there are footnotes present in the document but doesn't work if there are no footnotes, its looking for a footnote but if not there its creating the error. Would something like this work do you think?

Code:
For Each oRng In ActiveDocument.StoryRanges
With oRng
Select Case .StoryType
Case wdMainTextStory, wdFootnotesStory
I have also done as you suggested and split the other code into 3 sections and added as Calls to the Sub MainProcedure.
Reply With Quote