Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-15-2019, 12:01 PM
StephenRay StephenRay is offline User-Defined Type is Not Defined Windows 7 64bit User-Defined Type is Not Defined Office 2010 64bit
Advanced Beginner
User-Defined Type is Not Defined
 
Join Date: Jan 2012
Location: Overland Park, Kansas
Posts: 53
StephenRay is on a distinguished road
Default User-Defined Type is Not Defined

Friends, Please help me yet once again.
Many of my Macros suddenly stopped working. I lost all my macros but luckily, I had backup copies of all my Macros. And I had to re-do about 50 short-cut keys!



I figured out they updated the system to Office 365. So I know it is some setting somewhere.

Please see attachment for the error that I copied and pasted.

Dim clipboard As MSForms.DataObject

Compile Error:
User-defined type not defined.

It had been working previously. There are many similar errors in other Macros.
This is just one example.
Thank you in advance for your help.
Attached Files
File Type: docx User-Defined Type Not Defined.docx (43.6 KB, 11 views)
Reply With Quote
  #2  
Old 04-15-2019, 04:22 PM
Guessed's Avatar
Guessed Guessed is offline User-Defined Type is Not Defined Windows 10 User-Defined Type is Not Defined Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,158
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

You are missing a reference. Have a look at this webpage for how to add the reference https://www.excelforum.com/excel-pro...ataobject.html
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 04-18-2019, 10:13 AM
StephenRay StephenRay is offline User-Defined Type is Not Defined Windows 7 64bit User-Defined Type is Not Defined Office 2010 64bit
Advanced Beginner
User-Defined Type is Not Defined
 
Join Date: Jan 2012
Location: Overland Park, Kansas
Posts: 53
StephenRay is on a distinguished road
Default

GUESSED, thanks,
I have FM20.dll
It is located at C:\Windows\System32
Is this the right location?
My Computer:
Windows 10 Enterprise, 64 Bit, Office365 Pro Plus
The webpage you suggested said that if all fails, try to explicityly reference the dataobject as being from the Forms library like this:
Dim ClipboardISBN as MSForms.dataobject
I would hate to do this in 29 places in all my MACROS.
But I will try it and we will see what happens.
Reply With Quote
  #4  
Old 04-18-2019, 10:40 AM
StephenRay StephenRay is offline User-Defined Type is Not Defined Windows 7 64bit User-Defined Type is Not Defined Office 2010 64bit
Advanced Beginner
User-Defined Type is Not Defined
 
Join Date: Jan 2012
Location: Overland Park, Kansas
Posts: 53
StephenRay is on a distinguished road
Default

Well, that did not work, Please see attachment.
And the FM20.dll is an old file from 2015, please see the other attachment.

How can I tell if MSFORMS is installed and ok? Could that be the problem?
Attached Images
File Type: png CaptureXX.PNG (10.4 KB, 33 views)
File Type: png Capturexxx.PNG (13.5 KB, 33 views)
Reply With Quote
  #5  
Old 04-18-2019, 03:37 PM
Charles Kenyon Charles Kenyon is offline User-Defined Type is Not Defined Windows 10 User-Defined Type is Not Defined Office 2016
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,455
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

For future reference, keep backups of your work.

Store your macros and related keyboard shortcuts in a separate Global Template, not in the normal template.
Reply With Quote
  #6  
Old 04-18-2019, 04:15 PM
StephenRay StephenRay is offline User-Defined Type is Not Defined Windows 7 64bit User-Defined Type is Not Defined Office 2010 64bit
Advanced Beginner
User-Defined Type is Not Defined
 
Join Date: Jan 2012
Location: Overland Park, Kansas
Posts: 53
StephenRay is on a distinguished road
Default

Charles Kenyon, Omigosh! You can save the Keyboard Shortcuts?!? I never heard of anything like that. In this very large building of about 1,300 people, I am the only one who uses Macros.
You'd better believe I am going to figure out how to do that! Thanks for the link.
But would I be able to restore all my Keyboard Shortcuts in case of an update to a new version or hard drive failure? It would have to be stored on another computer. They never tell us ahead of time about updates.
Reply With Quote
  #7  
Old 04-19-2019, 12:41 AM
Guessed's Avatar
Guessed Guessed is offline User-Defined Type is Not Defined Windows 10 User-Defined Type is Not Defined Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,158
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Just having the file is not enough. When you browse to it, you have to select it and click OK. Then you check it comes up as ticked in your References list.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #8  
Old 04-19-2019, 07:46 AM
StephenRay StephenRay is offline User-Defined Type is Not Defined Windows 7 64bit User-Defined Type is Not Defined Office 2010 64bit
Advanced Beginner
User-Defined Type is Not Defined
 
Join Date: Jan 2012
Location: Overland Park, Kansas
Posts: 53
StephenRay is on a distinguished road
Default

Guessed, I will work on it this weekend. This is difficult for me. I don't know where to go to "Select" the file, as you said. I foolishly went to File Explorer - C:\Windows\System32\FM20.dll
This is not the right place.
Reply With Quote
  #9  
Old 04-19-2019, 04:34 PM
StephenRay StephenRay is offline User-Defined Type is Not Defined Windows 7 64bit User-Defined Type is Not Defined Office 2010 64bit
Advanced Beginner
User-Defined Type is Not Defined
 
Join Date: Jan 2012
Location: Overland Park, Kansas
Posts: 53
StephenRay is on a distinguished road
Default

My problem is that some of my macros will not work anymore. They used to work fine. I think they updated to a new version of Word366 and this new Word Version is not quite right yet.

The Macro stops dead in its tracks with this command highlighted in blue:
Dim myData As DataObject

Also there is a little box with this error inside: Compile error: User-defined type not defined.
I have C:\Windows\System32\FM20.dll
Windows 10 Enterprise, 64 Bit, Office365 Pro Plus

And I don't know where to go or how to register FM20.dll
Reply With Quote
  #10  
Old 04-19-2019, 08:24 PM
gmayor's Avatar
gmayor gmayor is offline User-Defined Type is Not Defined Windows 10 User-Defined Type is Not Defined Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

On a 64 bit Windows system FM20.DLL should be in the folder C:\Windows\SysWOW64.
First move the file to that folder.
Next From the Windows start menu, right click Windows Command Prompt and select More > Run as Administrator. A small black window will open with a flashing cursor.
At the prompt type
regsvr32 "C:\Windows\SysWOW64\FM20.dll"
and press the Enter key.
You should get confirmation that the file is registered.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #11  
Old 04-21-2019, 06:24 PM
StephenRay StephenRay is offline User-Defined Type is Not Defined Windows 7 64bit User-Defined Type is Not Defined Office 2010 64bit
Advanced Beginner
User-Defined Type is Not Defined
 
Join Date: Jan 2012
Location: Overland Park, Kansas
Posts: 53
StephenRay is on a distinguished road
Default

GMayor, Thank you, I will try it tomorrow morning at work.
Reply With Quote
  #12  
Old 04-23-2019, 05:19 AM
StephenRay StephenRay is offline User-Defined Type is Not Defined Windows 7 64bit User-Defined Type is Not Defined Office 2010 64bit
Advanced Beginner
User-Defined Type is Not Defined
 
Join Date: Jan 2012
Location: Overland Park, Kansas
Posts: 53
StephenRay is on a distinguished road
Default

GMayor,
That didn't work, I am sure it is a permissions issue. I will get a tech person here to help me with Administrative Rights.
I am convinced the problem is the Registration of FM20.dll -as you say.
When I get it registered, I will let you know if all is well or not.
In this very large office of 1,300 people nobody else uses MACROS but me.
Reply With Quote
  #13  
Old 04-23-2019, 08:04 AM
StephenRay StephenRay is offline User-Defined Type is Not Defined Windows 7 64bit User-Defined Type is Not Defined Office 2010 64bit
Advanced Beginner
User-Defined Type is Not Defined
 
Join Date: Jan 2012
Location: Overland Park, Kansas
Posts: 53
StephenRay is on a distinguished road
Default

GMayor,
It registered ok, please find attachment, screen shot of the Command Prompt Window and success window.
But I still get the same error.
I rebooted too, but the same error appears.
Attached Files
File Type: docx Registered.docx (27.7 KB, 9 views)
Reply With Quote
  #14  
Old 04-23-2019, 04:08 PM
Guessed's Avatar
Guessed Guessed is offline User-Defined Type is Not Defined Windows 10 User-Defined Type is Not Defined Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,158
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

In the VBA Editor while looking at the macro...

Go to Tools > References. This opens the References dialog
In the References dialog, find Microsoft Forms 2.0 Object Library and put a tick beside it and press OK

If the References dialog doesn't show Microsoft Forms x.x Object Library, click the Browse... button and an Add Reference dialog appears (with the System32 folder open).
Find the FM20.dll file and select it and click the Open button. This returns you to the References dialog and you should now see the object library in the list and it will be ticked.
Click the OK button to close the References dialog.
Go to Debug > Compile Project and you should now see that line in your code is now accepted

IF any of the menu commands are greyed out, click the Reset (square) button on the toolbar to stop the macro - when a macro is paused, some of the menu commands are not available.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #15  
Old 04-25-2019, 06:31 AM
StephenRay StephenRay is offline User-Defined Type is Not Defined Windows 7 64bit User-Defined Type is Not Defined Office 2010 64bit
Advanced Beginner
User-Defined Type is Not Defined
 
Join Date: Jan 2012
Location: Overland Park, Kansas
Posts: 53
StephenRay is on a distinguished road
Default

Guessed,
Thank you for your reply, I will take some time with it soon. I am working 12 hour days here, so I don't have a lot of time. Yesterday they said some of us should come in on Sunday too!
I am all by myself with MACROs but they have several of us trying to learn PowerShell to use with Active Directory.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
User-Defined Type is Not Defined FileSystemObject Compile Error: User-Defined Type Not Defined gsrikanth Excel Programming 2 03-28-2022 06:32 AM
User-Defined Type is Not Defined Application Defined or Object defined error bennyamy Excel Programming 4 03-23-2017 11:42 AM
User-Defined Type is Not Defined User-defined Type not Defined VBA Issue OTPM Project 3 01-02-2014 01:47 PM
User-Defined Type is Not Defined Range.Information(wdStartOfRangeRowNumber): Application-defined or Object-defined err tinfanide Excel Programming 2 06-09-2012 10:19 AM
User-Defined Type is Not Defined Application-defined or Object-defined error Manit Excel Programming 4 12-08-2011 07:35 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:23 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft