Solved

after upgrade to windows 10 vba dataobject.putinclipboard stops working

Posted on 2016-07-31
13
191 Views
Last Modified: 2016-11-30
after upgrading windows 7 pro to windows 10 pro the following code does not work in excel 2010 word 2010 or outlook 2010 .  I have found other forums that confirm this as a problem and give workarounds using other APIs, but I really hate searching dozens of my programs to replace simple code with complicated APIs.

I have tried repairing office 2010 pro, but that did not solve the problem.

Does anybody have a fix? If not does anybody have a computer where this works with windows 10 and excel 2010 ?

Sub test()
Dim Dto As New DataObject
Dto.SetText "test"
Dto.PutInClipboard

Dto.GetFromClipboard
mystring = Dto.GetText
MsgBox " this shows that the clipboard contains <" & mystring & ">. BUT if you paste the clipboard into notepad, you get ??"


End Sub
0
Comment
Question by:rberke
13 Comments
 
LVL 14

Expert Comment

by:DrTribos
ID: 41736849
Works with Word 2010  in Win 10...  Message box displayed "test" pasted to immediate window: "test"
0
 
LVL 14

Expert Comment

by:DrTribos
ID: 41736857
Worth mentioning for any VBA noobs that in order for this to even compile you need a reference to  the "Microsoft Forms 2.0 Object Library" which you can find via: Tools > References, then browse and add the reference (or just add a userform to your project and it will appear automagically).
0
 
LVL 45

Expert Comment

by:aikimark
ID: 41736891
I'm a fan of late binding, which doesn't rely on type library references in the VBA project.
0
 
LVL 5

Author Comment

by:rberke
ID: 41737838
Since DrTribos told me it worked for him, I decided to update a coworker's Office 2010 Home and Business computer from windows 7 pro to windows 10.  The code works on that computer, but not on mine.

I have already tried the following:
* Rebooting
* repairing my office 2010 pro
* copying the coworker's c:\windows\sysWOW64\fm20.dll on top of mine followed by  Regsvr32

What to do next? I am toying with running an sfc /scannow, but that seems a little drastic.  And, even more drastic would be to revert to Windows 7.

Also, the following code is interesting. Run it, then click OK and the .gettext shows clipboard with '??'.  But, if you remove linexxx, the .gettext shows "test2"
Sub test()

Dim Dto As New DataObject
        Dto.SetText "test2"
        Dto.PutInClipboard
linexxx:  MsgBox "click OK"
        Dto.GetFromClipboard
        MsgBox " clipboard now has " & Dto.GetText
End Sub

Open in new window

0
 
LVL 14

Accepted Solution

by:
DrTribos earned 500 total points
ID: 41738065
Just for fun... try a different user profile on your pc....
0
 
LVL 5

Author Comment

by:rberke
ID: 41738158
Should I laugh ?? or should I vomit ??

I signed on as Administrator and the program worked.
I then signed on as mydomain\rberke  and the programs now works !!!!  Outlook, Word, Excel, MS Access are all fine !!!

How much other crap do you suppose I have in store ?
Normally, I would just rebuild my profile and get it over with - but the company wants to migrate everybody to windows 10.  The idea of rebuilding everybody's profile is not pleasant, so I think I will stick with my current profile and see what other land mines I encounter.

Thanks for the suggestion, and here come the points.
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 14

Expert Comment

by:DrTribos
ID: 41738164
vol - yep that's a new one... vomit out loud.  And, enjoy the extra advertising that the anniversary edn of W10 promises to deliver...  welcome
0
 
LVL 5

Author Comment

by:rberke
ID: 41739952
bad news.  The problem has resurfaced in mydomain\rberke profile (the localcpu\administrator profile still works properly)

I googled for "rebuild windows 10 profile" and found lots of horror stories.  It appears the only reliable way to upgrade to windows 10 is to reformat the disk and reinstall windows 10 form scratch.  But some folks report good results with creating a new profile, so that is what I will do.

This will have to wait until the weekend so I'll post back after the work is done.
0
 
LVL 14

Expert Comment

by:DrTribos
ID: 41739970
More v less l 😣
0
 

Expert Comment

by:Excel Kid
ID: 41878783
Hello,

Sorry to pile on on an old post. But I seem to have the exact same problem.
I have used this little code in a number of places and replacing it with those complicated API calls seems like a horrible solution.

Did you actually fix this on your win10 machine? Could you please share the solution if you did?
0
 
LVL 5

Author Comment

by:rberke
ID: 41878978
"Did you actually fix this on your win10 machine?"

Possibly.  try this
Log of yourdomain\yourname
Switch user and log in as local administrator   cpu123\administrator
open word and excel
logoff of cpu123\administrator
log on as yourdomain\yourname.

I did the above about two weeks ago, and the dataobject problem has gone away.  But it was so random before that I can't be sure it is completely resolved.  By the way, I am still using the same user profile that was corrupted.

Please post back how well that worked.
0
 
LVL 5

Author Comment

by:rberke
ID: 41907970
My fix worked for about 4 weeks, but then stopped working.

I still hope that creating a completely new profile will solve the problem, but I won't be doing that anytime soon.

Bob
0
 
LVL 14

Expert Comment

by:DrTribos
ID: 41907992
You know what...

I'd really like to start collecting information for all these issues.... there must be something buried in the registry somewhere.  I've started collecting registry keys for PCs that crash MS Word for no reason.... (but when I say "just started", I mean it.... so far I have 1 key)

Word can be so temperamental... how about create a new 'spare' profile and test that the issue is not present.  Continue using the old profile...  see if you can fix the old profile.... then when it breaks again... see if it is also broken on the spare profile.... (i.e. that was created some time ago).
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This article will show you how to use shortcut menus in the Access run-time environment.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now