View Single Post
 
Old 11-20-2021, 06:21 AM
p45cal's Avatar
p45cal p45cal is offline Windows 10 Office 2019
Expert
 
Join Date: Apr 2014
Posts: 871
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

Just at first glance (I haven't looked in depth) I notice you're using late binding which could mean that many of the Word enumerations (eg. wdActiveEndAdjustedPageNumber) won't be recognised by Excel.
Either set a (temporary if you like) reference to Word in the VBE's Tools|References dialogue box: (see pic below)


or you'll need to find the value of each (and recognise them in the first place!) and replace them with their numerical value (1 in the case of wdActiveEndAdjustedPageNumber)


The line in your macro:
On Error Resume Next
is going to hide many errors from you, disable it and step through the code with F8 on the keyboard so that you can see which lines are going wrong.
Attached Images
File Type: png 2021-11-20_132834.png (9.7 KB, 15 views)
Reply With Quote