?
Solved

after upgrade to windows 10 vba dataobject.putinclipboard stops working

Posted on 2016-07-31
16
Medium Priority
?
1,565 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
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 46

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
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
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 2000 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

850 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