Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-11-2022, 10:17 PM
brownees brownees is offline InputBox error Windows 10 InputBox error Office 2021
Novice
InputBox error
 
Join Date: May 2022
Location: Tauranga, New Zealand
Posts: 8
brownees is on a distinguished road
Default InputBox error

Why am I getting a "Command failed" error with the following macro? It doesn't like ReferenceItem:="PhotoNum"


Sub PhotoCrossReference()


'Inserts cross reference to photo number input by user

Dim PhotoNum As Integer
PhotoNum = InputBox("Insert photo number", "Photo cross-reference", "1")

'Output cross reference
Selection.InsertCrossReference ReferenceType:="Photo", ReferenceKind:= _
wdOnlyLabelAndNumber, ReferenceItem:="PhotoNum", InsertAsHyperlink:=False, _
IncludePosition:=False, SeparateNumbers:=False, SeparatorString:=" "

End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
vba inputbox method problems jmcsa3 Excel Programming 2 08-26-2020 09:02 AM
Macro to add terminology via inputbox ZiggyPop Word VBA 0 03-07-2017 04:06 AM
InputBox selects rows Dave T Excel Programming 5 09-05-2016 06:58 AM
VBA Macro for word with Inputbox ryanch69 Word VBA 2 12-03-2015 07:45 AM
InputBox error Idiot Proof Entry with InputBox arpirnat Word VBA 1 04-27-2015 10:03 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:20 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