Results 1 to 6 of 6

Thread: Macro won't run

  1. #1
    New Lounger
    Join Date
    Apr 2008
    Location
    Seattle, Washington, USA
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've got a macro that I was using fine a while ago. I had to disable all macro activity for distribution, but now I want to use it again.

    There is a line in the macro that says:

    'Requires a Reference to the Microsoft Forms 2.0 Object Library
    If ActiveWindow.Selection.Type <> ppSelectionText Then
    MsgBox "Click in the textbox where you want to paste, then try again."
    Exit Sub
    End If

    I thought that what I did to satisfy this requirement was to just insert a blank userform. I tried that and also tried inserting a blank Module and a blank Class Module, but I still get teh error message:
    Compile error: User-defined type not defined.

    Can't figure out what I'm missing here. Any suggestions?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    The code that you posted doesn't require a reference to the Microsoft Forms 2.0 Object Library, it is 100% PowerPoint VBA.

    Could you post more of the code, or attach a copy of the presentation (zipped; you can remove all slides except the first one, and remove all text from that slide)


  3. #3
    New Lounger
    Join Date
    Apr 2008
    Location
    Seattle, Washington, USA
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by HansV View Post
    The code that you posted doesn't require a reference to the Microsoft Forms 2.0 Object Library, it is 100% PowerPoint VBA.

    Could you post more of the code, or attach a copy of the presentation (zipped; you can remove all slides except the first one, and remove all text from that slide)
    [attachment=86557:Broken Macro.zip]

    Here's a sample document with the inop macro in it.
    Attached Files Attached Files

  4. #4
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts
    Quote Originally Posted by jopakent View Post
    [attachment=86557:Broken Macro.zip]

    Here's a sample document with the inop macro in it.
    I get the same error as you, and inserting an unused userform was sufficient to correct the error.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    The line that caused the error message was just below the code that you posted:

    Dim clip As New MSForms.DataObject

    If I insert a userform, then delete it, the required reference has been set. The code then works correctly. See the attached version (I removed the background pictures to reduce the file size by a factor 50).

    [attachment=86559:Broken Macro.zip]

    Attached Files Attached Files

  6. #6
    New Lounger
    Join Date
    Apr 2008
    Location
    Seattle, Washington, USA
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by HansV View Post
    The line that caused the error message was just below the code that you posted:

    Dim clip As New MSForms.DataObject

    If I insert a userform, then delete it, the required reference has been set. The code then works correctly. See the attached version (I removed the background pictures to reduce the file size by a factor 50).

    [attachment=86559:Broken Macro.zip]
    Thanks, not sure why it didn't work for me. It does in the attachment you sent. I found an old file that still had a userform in it and am using that successfully now.

    Thanks again for your assistance.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •