Hi,
I'm trying to insert 02 buttons into my custom ribbon toolbar.
01. Next Comment
02. Previous Comment
I know it's already appear on 'Review' tab in MS Word. But I don't know the exact callback ID for that.
Is there any URL to refer all of the MS Word ribbon callback functions?
Thanks!
How to navigate next and previous comments by word macro
-
- 3StarLounger
- Posts: 318
- Joined: 23 Aug 2016, 07:43
- Location: Sri Lanka
-
- Administrator
- Posts: 78883
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: How to navigate next and previous comments by word macro
Does idMso tables help?
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 318
- Joined: 23 Aug 2016, 07:43
- Location: Sri Lanka
Re: How to navigate next and previous comments by word macro
Thank you Hans,
I found 02 Control IDs for this. Now I've to insert those IDs into my ribbon xml file. I added it as follows. But not works for me.
I think it cannot be use as 'onAction'.
I found 02 Control IDs for this. Now I've to insert those IDs into my ribbon xml file. I added it as follows. But not works for me.
Code: Select all
<button
id="B9"
image="n"
label="Next"
screentip="Next"
showImage="true"
showLabel="true"
size="normal"
supertip="Go To Next Comment"
visible="true"
onAction="ReviewNextComment"/>
<button
id="B10"
image="p"
label="Previous"
screentip="Previous"
showImage="true"
showLabel="true"
size="normal"
supertip="Go To Previous Comment"
visible="true"
onAction="ReviewPreviousComment"/>
-Sampath-
-
- Administrator
- Posts: 78883
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: How to navigate next and previous comments by word macro
Try using ReviewNextCommentWord instead of ReviewNextComment, and ReviewPreviousCommentWord instead of ReviewPreviousComment
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 318
- Joined: 23 Aug 2016, 07:43
- Location: Sri Lanka
Re: How to navigate next and previous comments by word macro
Hi Hans,
I tried ReviewNextCommentWord and ReviewPreviousCommentWord. But I think still It's not call to the exact word command. I got the following warning message:
I tried ReviewNextCommentWord and ReviewPreviousCommentWord. But I think still It's not call to the exact word command. I got the following warning message:
You do not have the required permissions to view the files attached to this post.
-Sampath-
-
- Administrator
- Posts: 78883
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: How to navigate next and previous comments by word macro
I'm afraid I can't help you, sorry.
Best wishes,
Hans
Hans
-
- Panoramic Lounger
- Posts: 8254
- Joined: 25 Jan 2010, 09:09
- Location: retirement
Re: How to navigate next and previous comments by word macro
To call a macro from a Ribbon button created by RibbonX XML you must indicate that the macro is a 'Ribbon thingy' (my terminolgy :grin). What I mean is, you can't call a macro via 'onAction=' in XML unless your macro is named in the following style:
However, once you've defined your Sub in that way you can't then just run it from the VBE without first removing the (control As IRibbonControl) bit and that makes debugging fiddly as you're constantly editing the name of the macro. To ease this, I've organised things as follows:
1) Inserted a module called modRibbonCalls
2) In that module, created as many Subs as I have macros on my Ribbon tab. Each Sub is named in the style:
Sub rbnMyMacro1(control As IRibbonControl)
3) Each Sub contains only one line, a call to the relevant macro
Call MyMacro1
4) In the XML, point each 'onAction' to the relevant 'rbn' version of the macro
onAction=rbnMyMacro1
Does this help?
Ken
Code: Select all
Sub MyMacro(control As IRibbonControl)
code goes here
End Sub
1) Inserted a module called modRibbonCalls
2) In that module, created as many Subs as I have macros on my Ribbon tab. Each Sub is named in the style:
Sub rbnMyMacro1(control As IRibbonControl)
3) Each Sub contains only one line, a call to the relevant macro
Call MyMacro1
4) In the XML, point each 'onAction' to the relevant 'rbn' version of the macro
onAction=rbnMyMacro1
Does this help?
Ken
-
- 3StarLounger
- Posts: 318
- Joined: 23 Aug 2016, 07:43
- Location: Sri Lanka
Re: How to navigate next and previous comments by word macro
Thank you Hans and Stuck,
Earlier I used 02 simple macros to jump a comment by comment. It's works perfectly.
My only concern is the above macros not selecting the current comment placement (Please see below image for more clarity). Any way to develop this macro to jump comment by comment and select current comment place by a macro? (Similar option already available on Reviews >> Next/Previous buttons. But I've no idea to add those buttons to my custom ribbon toolbar)
Thanks and have a great week end!
Earlier I used 02 simple macros to jump a comment by comment. It's works perfectly.
Code: Select all
'Next Comment
Private Sub NextComment(control As IRibbonControl)
Selection.GoToNext wdGoToComment
End Sub
'Previous Comment
Private Sub PreviousComment(control As IRibbonControl)
Selection.GoToPrevious wdGoToComment
End Sub
Thanks and have a great week end!
You do not have the required permissions to view the files attached to this post.
-Sampath-
-
- Administrator
- Posts: 78883
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: How to navigate next and previous comments by word macro
The built-in buttons and the macros that you posted operate in exactly the same way as far as I can tell. But the way they work depends on where the selection/insertion point is located:
If the selection/insertion point is located in the body of the document, the anchor of the next (or previous) comment will be selected.
If the selection/insertion point is located in the text of a comment, you'll be taken to the next (or previous) comment.
If the selection/insertion point is located in the body of the document, the anchor of the next (or previous) comment will be selected.
If the selection/insertion point is located in the text of a comment, you'll be taken to the next (or previous) comment.
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 318
- Joined: 23 Aug 2016, 07:43
- Location: Sri Lanka
Re: How to navigate next and previous comments by word macro
Hi Hans,
Thank you for your quick response.
Yah.. I got your point. So, is there any way to change cursor location point in above macro to select comment?
Thank you for your quick response.
Yah.. I got your point. So, is there any way to change cursor location point in above macro to select comment?
-Sampath-
-
- Administrator
- Posts: 78883
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: How to navigate next and previous comments by word macro
As far as I can tell, that is not possible, but perhaps someone else knows how to do that.
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 318
- Joined: 23 Aug 2016, 07:43
- Location: Sri Lanka
Re: How to navigate next and previous comments by word macro
Thank you Hans. I'll try to find some solution for that.
-Sampath-