5

In my Excel 2016 project (Windows 7), I'd like to work with the clipboard:

Dim DataObj As New MSForms.DataObject
DataObj.GetFromClipboard

But I've got this compiler Error at the first line of code:

User-defined type not defined

So I would like to add the reference to the Microsoft Forms 2.0 Object Library but I have no FM20.DLL file on my entire computer (I have searched through explore and find with cygwin).

I expect to see it as in the screenshot below, but I can't find it.

VBA list of available references

How can I make it appear?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Lime
  • 13,400
  • 11
  • 56
  • 88
  • 1
    You don't need Forms 2.0 to work with the Windows clipboard - use the Win32 API instead, see [this thread on MSDN](https://social.msdn.microsoft.com/Forums/office/en-US/ee9e0d28-0f1e-467f-8d1d-1a86b2db2878/a-clipboard-object-for-vba-including-microsoft-word?forum=worddev) – Mathieu Guindon Feb 27 '16 at 02:10
  • @Mat'sMug So legacy code can no longer work is that correct? Here is one such code that I'm trying to get working. http://mathematica.stackexchange.com/questions/14658/exporting-data-from-excel-into-mathematica-using-clipboard/14659#comment293526_14659 – Lime Feb 27 '16 at 02:13
  • Are there any forms in your VBA project? If not, try adding one. – Mathieu Guindon Feb 27 '16 at 02:15
  • @Mat'sMug Yes already tried that. – Lime Feb 27 '16 at 02:15
  • You should mention it in your post then, because as it stands your question looks pretty much like an exact duplicate of [this one](http://stackoverflow.com/q/35610429/1188513). – Mathieu Guindon Feb 27 '16 at 02:18
  • @Mat'sMug Yes almost added a bounty on that but had no ability to accept the right answer. – Lime Feb 27 '16 at 02:21
  • The path to the FM20.DLL shown in the screenshot is totally different to the path I have on my system (Win7/Excel 2016). On my system it's at `C:\Windows\SysWOW64\FM20.DLL` – barrowc Feb 27 '16 at 02:29
  • @barrowc Not there either. I no longer have it open but I did a global search on my entire OS(I'm 99% sure it was done). – Lime Feb 27 '16 at 02:33
  • 1
    And have you tried to re-install Excel? When re-installing take care about the tools for Office and VBA. – Daniel Dušek Feb 29 '16 at 18:55
  • Do you see it if you click on References browser? – 0m3r Mar 07 '16 at 00:04
  • @Om3r I did a search of my entire computer for such a file. I will post if I determine if that works but it is most unlikely. – Lime Mar 07 '16 at 05:20
  • you may want to edit your tags with office and window version you are using – 0m3r Mar 07 '16 at 05:24
  • I'm positive the file was on there, the OP was just having trouble locating it. It's a little late now but I would've asked *how* did you do this full search, and also explain that "99% sure" is not "sure" – ashleedawg Nov 05 '18 at 19:20
  • @ashleedawg find command in cygwin – Lime Nov 05 '18 at 19:35

8 Answers8

10

On 64-bit machines, FM20.dll is in the C:\Windows\sysWOW64 directory. It's 32 bit.

Nathan Tuggy
  • 2,237
  • 27
  • 30
  • 38
jules3766
  • 101
  • 1
  • 4
  • 1
    This is the correct answer, don't be confused by the accepted answer... – Thomas Sep 12 '19 at 12:55
  • Not only it is the correct answer, but does help explain this [strange behaviour that I noticed and asked why](https://stackoverflow.com/q/57260380/2752308). – Marcelo Scofano Diniz Dec 23 '20 at 19:31
  • 1
    I have Office 64-bit and FM20.dll is not in the sysWOW64 folder, but is in the C:\Windows\System32 folder (strangely, only when browsing from the "References - VBAProject box, but is not visible in Windows Explorer even with all files showing including hidden/protected system files). I'm not sure if it will work correctly with Excel 64-bit, but so far so good. –  Feb 24 '22 at 06:50
2

I found FM20.DLL in C:\Program Files (x86)\Microsoft Office\root\VFS\SystemX86; that's with MS Office 2016 and Windows 10.

V Ward
  • 23
  • 5
1

Maybe you can try a late binding using the CLSID

Dim MyDataObj As Object Set MyDataObj = CreateObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")

or something like that.

1

Just to sort of summarize my experience and what I've seen listed here - FM20.dll can be found in any of these places:

C:\Windows\System32\
C:\Windows\SysWOW64\
C:\Program Files\Microsoft Office\root\vfs\System\
C:\Program Files (x86)\Microsoft Office\root\vfs\SystemX86\

Note that alternatively the GUID is:

{1C3B4210-F441-11CE-B9EA-00AA006B1A69}
Marcucciboy2
  • 3,156
  • 3
  • 20
  • 38
0

From this old knowledge base article my guess would be this DLL is perhaps only included in older versions of Office? This part seemed promising:

As an alternative to having your end users install Microsoft Office, you can have them freely download and install the Microsoft ActiveX Control Pad, which also installs the Fm20.dll. For more information, see the following Microsoft Developer Network (MSDN) Web site: http://msdn.microsoft.com/en-us/library/ms968493.aspx

However, as the linked tool is from 1997, you'll need to run its setup in "compatibility mode" by right-clicking on the executable and selecting "Properties" then clicking on the "Compatibility" tab and selecting "Windows 95" in the "Run this program in compatibility mode for:" dropdown. Then run it as administrator (this worked for me using Windows 8.1).

Steve Chambers
  • 37,270
  • 24
  • 156
  • 208
  • Nope, FM20 should be in all Office installations which include VBA. – jkpieterse Feb 29 '16 at 14:31
  • @jkpieterse It should but isn't always by evidence of the computers I have used. Also the link is 32bit only. Funny thing I actually tried it before posting the question. I didn't give the downvote by I will try the compatibility mode at some point although Im quite certain it won't work. – Lime Feb 29 '16 at 17:34
  • 1
    I've never had one without fm20.dll, so these must be incomplete Office installations. Try a full install. Note that if you have a click to run Office 2016 installation is streamed "as you go" so it might take some time before you have everything. – jkpieterse Mar 01 '16 at 19:56
0

Also like to add that I have found that when a MS .accdb file is copied/pasted for back up, the VBA reference to the FM20.dll can be lost so needs to be reestablished.

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 24 '21 at 00:54
0

In the browse button seek C:\Program Files\Microsoft Office\root\Office16\Excel.exe that's work for me.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 25 '23 at 11:40
-1

That library should really be there. I just checked on my Excel 2016 installation (32 bit) and it is there by default (just not checked). I recommend to repair your Office if it isn't there.

jkpieterse
  • 2,727
  • 1
  • 9
  • 18