Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-18-2015, 11:02 PM
Guessed's Avatar
Guessed Guessed is offline Inserting Cross References into Cell Windows 7 32bit Inserting Cross References into Cell Office 2010 32bit
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Inserting something into a range can be problematic when it already has content.



Try defining a range and then collapsing that to a specific location
Code:
  Dim aRng As Range
  Set aRng = ActiveDocument.Range.Tables(1).Cell(2, 2).Range
  aRng.Collapse wdCollapseStart
  aRng.InsertCrossReference ReferenceType:=wdRefTypeBookmark, ReferenceKind:=wdContentText, _
              ReferenceItem:="DATE", InsertAsHyperlink:=True
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #2  
Old 08-19-2015, 08:43 AM
mikemike616 mikemike616 is offline Inserting Cross References into Cell Windows 7 64bit Inserting Cross References into Cell Office 2013
Novice
Inserting Cross References into Cell
 
Join Date: Aug 2015
Posts: 7
mikemike616 is on a distinguished road
Default

Yes thank you. Collapsing the range beforehand does the trick.

For anyone else who may run into this problem, if you use "wdCollapseEnd" to insert a cross reference after preexisting text in a cell, it will put it in the next cell. To avoid this, use:

Code:
.MoveEnd Unit:=wdCharacter, Count:=-1
.Collapse wdCollapseEnd
This will subtract the last character off the range so when you collapse to the end, it will put the range at the last character in the cell.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert manual cross references in footnotes to other footnotes to automatic cross references ghumdinger Word VBA 7 11-20-2014 11:47 PM
Inserting Cross References into Cell Bookmarks & cross-references Suchoklates Word 1 09-19-2013 02:32 AM
Inserting Cross References into Cell Cross-References acolussi Word 9 05-16-2013 02:11 AM
MS Word cross-references? entity022 Word 3 06-03-2010 06:37 AM
Cross References egcharles Office 0 04-19-2009 06:20 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 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft