zachkirsch
06-26-2013, 03:56 PM
I need some help with using VBA and userform in Word 2010.
I know almost nothing when it comes to actual programming. I have created a userform using the UI, but it's kind of functionless at this point. The OK and Cancel buttons don't even do anything when clicked.
Here's a picture of the dialog box: https://www.dropbox.com/s/3g4ppnbwsgxbw52/My%20Dialog%20Box.png
Here's the (empty) code:
Private Sub AuthorName_Change()
End Sub
Private Sub AuthorNameLabel_Click()
End Sub
Private Sub CancelButton1_Click()
End Sub
Private Sub CancelButton2_Click()
End Sub
Private Sub Card_Change()
End Sub
Private Sub CardLabel_Click()
End Sub
Private Sub Comment_Change()
End Sub
Private Sub CommentLabel_Click()
End Sub
Private Sub DatePublished_Change()
End Sub
Private Sub DatePublishedLabel_Click()
End Sub
Private Sub FullCitation_Change()
End Sub
Private Sub FullCitationLabel_Click()
End Sub
Private Sub InsertCardButton1_Click()
End Sub
Private Sub InsertCardButton2_Click()
End Sub
Private Sub Institution_Change()
End Sub
Private Sub InstitutionLabel_Click()
End Sub
Private Sub Tag_Change()
End Sub
Private Sub TagLabel_Click()
End Sub
Private Sub Title_Change()
End Sub
Private Sub TitleLabel_Click()
End Sub
Private Sub URL_Change()
End Sub
Private Sub URLLabel_Click()
End Sub
My goal is for the "Insert Card" button to use the input from the dialog box to create a three-lined "card" (using a pre-defined template) right into the document where the blinking cursor is. The "card" template is:
[Tag] ([AuthorName] – [Institution])
[FullCitation][AuthorName] ([Institution]). “[Title].” [DatePublished]. [URL].
[Card]
Everything in brackets would be replaced by the input. Each line has its own style (Line 1 is 'Heading 5', Line 2 is a custom style 'Citation', Line 3 is a custom style 'Evidence'.)
In addition, if there is text entered in the "Comment" field in the dialog box I would like a comment (like Insert-->New Comment) to be created with that input (preferable the comment is selected on the first line of the "card" but its not that important).
Thanks for any and all help!
PS Here's my template in case it's not clear what I have so far:
https://www.dropbox.com/s/wvscdprwhs2rmi7/Dialog%20Box%20Template.dotm
I know almost nothing when it comes to actual programming. I have created a userform using the UI, but it's kind of functionless at this point. The OK and Cancel buttons don't even do anything when clicked.
Here's a picture of the dialog box: https://www.dropbox.com/s/3g4ppnbwsgxbw52/My%20Dialog%20Box.png
Here's the (empty) code:
Private Sub AuthorName_Change()
End Sub
Private Sub AuthorNameLabel_Click()
End Sub
Private Sub CancelButton1_Click()
End Sub
Private Sub CancelButton2_Click()
End Sub
Private Sub Card_Change()
End Sub
Private Sub CardLabel_Click()
End Sub
Private Sub Comment_Change()
End Sub
Private Sub CommentLabel_Click()
End Sub
Private Sub DatePublished_Change()
End Sub
Private Sub DatePublishedLabel_Click()
End Sub
Private Sub FullCitation_Change()
End Sub
Private Sub FullCitationLabel_Click()
End Sub
Private Sub InsertCardButton1_Click()
End Sub
Private Sub InsertCardButton2_Click()
End Sub
Private Sub Institution_Change()
End Sub
Private Sub InstitutionLabel_Click()
End Sub
Private Sub Tag_Change()
End Sub
Private Sub TagLabel_Click()
End Sub
Private Sub Title_Change()
End Sub
Private Sub TitleLabel_Click()
End Sub
Private Sub URL_Change()
End Sub
Private Sub URLLabel_Click()
End Sub
My goal is for the "Insert Card" button to use the input from the dialog box to create a three-lined "card" (using a pre-defined template) right into the document where the blinking cursor is. The "card" template is:
[Tag] ([AuthorName] – [Institution])
[FullCitation][AuthorName] ([Institution]). “[Title].” [DatePublished]. [URL].
[Card]
Everything in brackets would be replaced by the input. Each line has its own style (Line 1 is 'Heading 5', Line 2 is a custom style 'Citation', Line 3 is a custom style 'Evidence'.)
In addition, if there is text entered in the "Comment" field in the dialog box I would like a comment (like Insert-->New Comment) to be created with that input (preferable the comment is selected on the first line of the "card" but its not that important).
Thanks for any and all help!
PS Here's my template in case it's not clear what I have so far:
https://www.dropbox.com/s/wvscdprwhs2rmi7/Dialog%20Box%20Template.dotm