2016-07-30 1 views
1

MS Word 용 작은 템플릿이 있습니다. 하이퍼 링크가있는 주석을 추가하고 싶습니다. 다음 코드를 사용하여 주석을 추가 할 수 있지만 해당 주석의 작성자 이름을 설정하고 싶습니다. 어떻게해야할지 모르겠다.VBA를 사용하여 Word에서 주석에 작성자 이름을 설정하는 방법은 무엇입니까?

여기 내 작업 코드입니다 : (저자가 현재 설정되어 있지 않은)

URLText = "https:\\www.google.com" 
Selection.Comments.Add Range:=Selection.Range 
With Selection 
     .TypeText (CommentText)      'Add comment text 
     .Hyperlinks.Add Anchor:=Selection.Range, _  'Add hyperlink to comment 
     Address:=URLText, _ 
     ScreenTip:=URLText, _ 
     TextToDisplay:=URLText 
End With 

내가 코드를 따라 시도하지만. 어떤 작가 이름을 설정했지만 내 의견에 다음과 같은 방식으로 하이퍼 링크를 추가 할 수 없습니다.

Dim cmtMyComment As Comment 
Dim link As Hyperlink 
link.Address = URLText 
link.ScreenTip = URLText 
link.TextToDisplay = URLText 


Set cmtMyComment = Selection.Comments.Add(Range:=Selection.Range, _ 
Text:=(CommentText) 
cmtMyComment.Author = "ABC" 

하이퍼 링크를 설정할 속성을 찾지 못했습니다.

누구나 저자명 설정 방법을 제안 할 수 있습니까? 시도했지만 속성을 찾지 못했습니다.

답변

1

그럼 당신이 그렇게하고이

enter image description here

같은 코멘트가 발생합니다 어느

Public Sub AddCommentWithLink() 
    URLText = "https:\\www.google.com" 
    Set Comment = Selection.Comments.Add(Range:=Selection.Range) 
    Comment.Author = "Donald Duck" 
    With Selection 
      .TypeText (CommentText) 
      .Hyperlinks.Add Anchor:=Selection.Range, _ 
      Address:=URLText, _ 
      ScreenTip:=URLText, _ 
      TextToDisplay:=URLText 
    End With 
End Sub 

아래 GIF로 볼 수있는 하이퍼 링크는 여전히 작동처럼 설정할 수 있습니다 Author 특성이있다

+0

위의 기능을 알고 있지만 하이퍼 링크를 추가하는 방법을 모르겠습니다. 댓글에 하이퍼 링크가 포함 된 코드를 업데이트 할 수 있습니까? 그게 나를 도울 수있어. –

+0

그런 다음 질문을 조정하여 독자가 잘못된 방향으로 향하게 ... – DAXaholic

+0

고맙습니다. 다른 코드로 내 의견을 업데이트했습니다. 질문에 빠진 부분을 기꺼이 바꿀 것입니다. 질문이나 코드에 빠진 경우 제안 해 주시겠습니까? –