Excel 2010: Where is Microsoft Forms 2.0 Object Library?

RexSwain

New Member
Joined
Jun 19, 2010
Messages
9
I have a nice little macro
Code:
' Copy sum of selected cells into clipboard
Dim MyDataObj As New DataObject
MyDataObj.SetText Application.Sum(Selection)
MyDataObj.PutInClipboard
But it does not work in my new Excel 2010.

Apparently I need the Microsoft Forms 2.0 Object Library,
but that's not in the list at Tools|References !

Any suggestions...?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
As a test, try to add a userform to your project. If successful, a reference to that library will be automatically added for you.
 
Upvote 0
I can add a UserForm.

But I still get "Compile error: User-defined type not defined" when I try to run my macro.
 
Upvote 0
Once the userform has been added, has a reference to the Microsoft Forms 2.0 Object Library been added?
 
Upvote 0
Search your PC for the FM20.DLL file.

On my PC it is under C:\WINDOWS\system32
 
Upvote 0
That's the ticket! Manually adding FM20.DLL solves the problem -- now Microsoft Forms 2.0 Object Library appears in my list of references, and my macro works. Thanks very much for the name of the DLL -- that was the missing link.
 
Upvote 0
Thanks Rex for finding that file. I've tried to get the clipboard code working for hours. I guess it's simple when you know how.
 
Upvote 0
Hi there,
I am an Excel VBA enthusiast and really struggling with this concept of the "FM20.dll" file.
I found the DLL on the computer by doing a general search and pasted in the C:\Windows\System32 dir. I restarted Excel, added a userform (and tried deleting it again as well) - No change, still not able to use DataObject to copy cell string to clipboard.

So here is my scenario:
I created my own invoice sheet. The file will be saved as a PDF to send to clients. This PDF's name will vary depending on the information in the excel sheet. Info is gathered from different cells and added (as variables) together with static text to a single cell. The value of this cell (Not including the formula) must be copied to the clipboard so that when I press F12 to "save as", and choose the directory I only have to Ctr+V to paste the correct file name and click save.
The cell value (File Name) must be updated with every change in that sheet in order for it to have the latest details from the sheet for the name of the file.

So in short: I need to copy only the value of a cell as a text string to the clipboard to be available to be pasted as text as if you copied it from a MS Word doc - This cell value contains formula and text.

The formula I have tried includes the following:
'"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyData As DataObject
Set MyData = New DataObject

MyData.SetText (Range("O1:W1"))
MyData.PutInClipboard

End Sub
'"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""


Any help would be much much appreciated.
Thanks in advance.

Andrew
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,901
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top