Solved

after upgrade to windows 10 vba dataobject.putinclipboard stops working

Posted on 2016-07-31
16
520 Views
Last Modified: 2016-12-08
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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
16 Comments
 
LVL 15

Expert Comment

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

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 15

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
 
LVL 15

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 15

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 15

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
 
LVL 5

Author Comment

by:rberke
ID: 41918075
I finally have something that is repeatable. If any Explorer window is displaying any folder on  C:  or D: or E  then databobjects do not work.

if windows explorer is closed dataobjects work perfectly.

Dataobject fail if I have opened these 3 explorer windows:  1) This Pc    2) Quick access     3) desktop  
dataobjects work if I only have these open  1) This Pc    2) Quick access    

It appears that when any explorer window is related to a physical disk drive, dataobjects fail.

Bu dataobjects workt if all explorer windows are displaying a "simulated folder" which is entirely in the registry.

Right now, this is totally repeatable.  I am going to reboot and see if things change.

Sub t1246()
Dim test, newClip As String

Set test = CreateObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}") ' late binding to dataobject
        test.SetText "test"
        test.PutInClipboard
        Application.Wait (Now + TimeValue("00:00:02"))
       
        test.GetFromClipboard ' sometimes, when corruption occurs, debugger stops even when there is no error
        newClip = test.GetText
MsgBox "dataobject clipboard returned <" & newClip & ">"
End Sub
1
 
LVL 5

Author Comment

by:rberke
ID: 41918265
Excel Kid:
Last month you said you were having the exact same dataobject problem that I described.

If you still have the problem, please check something for me:  Close ALL  Explorer display windows and see if the problem goes away.

Then, open c:\  to display the root folders and see if the vba problem returns.
0
 
LVL 5

Author Comment

by:rberke
ID: 41918283
I believe the upgrade to windows 10 corrupted the MyDomain\rberke  profile.  
Under that profile, the dataobject does not work when Explorer is displaying a folder like c:\...   d:\... or  \\share\..,

Under other profiles like MyDomain\rberke2 everything seems to work fine.  Of course, if I used  mydomain\rberke2 for several weeks the corruption might return - but I don't think it will.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

726 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