Comments (4)
Hi, glad you like it.
Can you please provide a file for me to download which shows the effect so that I can have a look at it.
Best regards
from insertcrossreferencescomfortably.
Hi, thanks for the reaction.
hereby an example file.
Regards,
QvS1
from insertcrossreferencescomfortably.
Hi, thanks for the very helpful example file with which I could easily reproduce the effect.
I now had a look into the code to see what happens.
It turned out that Microsoft's call .GetCrossReferenceItems()
only presents the cross references (XRefs) which are plain inside the document body, but not those which are in those Textboxes.
I tried a workaround (see below) but that didn't work either.
I had to give up and will close the issue.
I would recommend that you remove those textboxes if you want to use my macros.
Sorry for not having better news. Best regards
' Regarding the issue that crossrefs are only found in the document body,
' but not if they are within Textboxes:
'
' Microsoft says (https://learn.microsoft.com/en-gb/office/vba/api/word.selection.insertcrossreference)
' that <Selection.InsertCrossReference()> can be used with <ReferenceItem> where
' "this argument specifies the item number or name in the Reference type box in the Cross-reference dialog box".
' We have found out, that the dialog box
' - first lists the cross references in the document body (wdMainTextStory ?)
' - then lists the cross references in the text boxes (wdTextFrameStory).
' This is true independent of the order of the elements in the document, so:
' first all Xrefs in the document, then all Xrefs in the TextFrames.
'
' Idea therefore: if the XRef was not found in the document body, then search in the TextFrames.
' This is what the below code does. It finds the XRef and returns the index,
' i.e. the ordinal of the XRef within the TextFrame XRefs.
' Then if we add this ordinal to the number of XRefs in the document body,
' we exactly get the "item number [..] in the Cross-reference dialog box", i.e. the Index. Sounds good so far.
' However, when pass this Index to <Selection.InsertCrossReference()> to actually insert the XRef,
' then this function crashes, apparently believing that the given index is out-of-bounds.
' So there is currently no solution. :-(
from insertcrossreferencescomfortably.
Hi, Thanks for taking the time looking in to this query.
Cheers,
QvS1
from insertcrossreferencescomfortably.
Related Issues (8)
- Error: User-defined type not defined HOT 1
- Hi,this code can't run in Office 365(Word) HOT 2
- Cannot work on MacOS HOT 1
- Cross-Reference Input: Error Fix Request HOT 2
- Error with Cross Reference in Citation Module with Style Separator HOT 8
- Cross-reference fails with uppercase formatting HOT 1
- Style Cycling Not Working for Images in Updated VBA HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from insertcrossreferencescomfortably.