Mediocre Egg
03-31-2008, 08:16 AM
I have a simple userform created, which takes the inputted information and dumps it into a Word .dot file with bookmarks.
Part of this userform involves dumping a previously taken screenshot into the document. To do this I used PasteSpecial.
Right now I have things set up to ignore an error if nothing is in the clipboard. That is fine with me because at that point the screenshot can easily be added manually.
But I'm having trouble figuring out what to do if there is an object in the clipboard, but it's not a screenshot. For example, if the user last copied a bunch of text, it will dump it into the document.
Is there a way to check that the clipboard file is an image file? If not, can anyone recommend a better way of doing what I'm trying to do?
The Sub in question:
Private Sub cmdSubmit_Click()
On Error Resume Next
With ActiveDocument
.Bookmarks("Reason").Range.Text = cboReason.Value
.Bookmarks("Duration").Range.Text = cboDuration.Value
.Bookmarks("Publication").Range.Text = cboPubName.Value
.Bookmarks("Comments").Range.Text = txtComments.Value
.Bookmarks("Screenshot").Range.PasteSpecial
End With
Application.ScreenUpdating = True
Unload Me
End Sub
Part of this userform involves dumping a previously taken screenshot into the document. To do this I used PasteSpecial.
Right now I have things set up to ignore an error if nothing is in the clipboard. That is fine with me because at that point the screenshot can easily be added manually.
But I'm having trouble figuring out what to do if there is an object in the clipboard, but it's not a screenshot. For example, if the user last copied a bunch of text, it will dump it into the document.
Is there a way to check that the clipboard file is an image file? If not, can anyone recommend a better way of doing what I'm trying to do?
The Sub in question:
Private Sub cmdSubmit_Click()
On Error Resume Next
With ActiveDocument
.Bookmarks("Reason").Range.Text = cboReason.Value
.Bookmarks("Duration").Range.Text = cboDuration.Value
.Bookmarks("Publication").Range.Text = cboPubName.Value
.Bookmarks("Comments").Range.Text = txtComments.Value
.Bookmarks("Screenshot").Range.PasteSpecial
End With
Application.ScreenUpdating = True
Unload Me
End Sub