Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-09-2024, 07:58 PM
brownees brownees is offline Insert photo reference inside callout Windows 10 Insert photo reference inside callout Office 2021
Novice
Insert photo reference inside callout
 
Join Date: May 2022
Location: Tauranga, New Zealand
Posts: 8
brownees is on a distinguished road
Default Insert photo reference inside callout

Hi all, text in caps below indicates my problem. Thanks in advance...

Sub InsertPhotoRefInsideCallout()
'
' Inserts photo label and number reference into callout



'Paste new autotext callout
Selection.TypeText "x"
Selection.Range.InsertAutoText

'WANTING FOLLOWING LINE TO MOVE CURSOR INSIDE CALLOUT SO PHOTO REFERENCE BELOW CAN BE PASTED
ActiveDocument.Shapes.Range(Array("Rounded Rectangular Callout 38")).Select


'Paste "Photo 1" reference in callout
Selection.InsertCrossReference ReferenceType:="Photo", ReferenceKind:= _
wdOnlyLabelAndNumber, ReferenceItem:="1", InsertAsHyperlink:=False, _
IncludePosition:=False, SeparateNumbers:=False, SeparatorString:=" "

End Sub
Reply With Quote
  #2  
Old 05-12-2024, 04:36 PM
Guessed's Avatar
Guessed Guessed is offline Insert photo reference inside callout Windows 10 Insert photo reference inside callout Office 2016
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

I think your logic is a little flawed because you aren't being explicit enough to determine which shape you want to address. It appears that it might work if you only ever use it once in a document but you will have several problems if you expect to use it a second time.

Presumably you got that shape name from the shape you saved it into the building blocks, what happens if you have inserted the building block more than once into the document, which instance should this cross-ref go into?
How should the callout be positioned if there is no position info about the photo caption which I assume is already on the page somewhere?
Typically, cross-references point at a caption and it is the caption that might be positioned in a text box sitting under the photo. The cross-reference normally sits somewhere in the text rather than in a shape on the page.

To get you started, have a look at this code. If you run it on a document containing a couple of your shapes you will see that you might have more than one shape with the same name but they will have a unique ID. You can also see that you can place text (or a cross-ref) inside a shape by using its TextFrame.TextRange.
Code:
Sub ShowMe()
  Dim aShp As Shape
  For Each aShp In ActiveDocument.Shapes
    Debug.Print aShp.Name, aShp.ID
  Next aShp
  With ActiveDocument.Shapes(1)
    .TextFrame.TextRange.Text = "Hi Mum"
  End With
End Sub
If this doesn't help, can you post a sample document showing the before/after result of what it is the macro should be able to achieve?
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cross-reference with full context a numbered list inside another multilevel list (list style) MatLcq Word 0 02-01-2021 06:00 AM
Insert photo reference inside callout How to make a transparent calendar outline, and insert it on top of a photo. TheSkiBoy PowerPoint 3 12-08-2014 12:33 PM
Insert a TOC inside a table cell simobk Word 3 10-28-2013 01:18 PM
Insert photo reference inside callout insert photo on top of movie wabash12 PowerPoint 2 06-14-2013 06:32 AM
Insert photo reference inside callout power point 2011 is there anyway to create a photo albumn(s) and insert the album bet Jrmatm26538 PowerPoint 6 02-14-2012 09:00 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:44 PM.


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