- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey Guys.
I have a macro that copy's the path of the selected part or assembly to the clipboard. I can then paste it in excel, or the browser or add that part in another assembly. I have been using this macro for years without problems.
We upgraded the laptops to Windows 10 4 months ago. the macro still worked perfectly.
Since a couple of days however it works at first, but gives me a strange problem after a while. I have not yet found the trigger for it to start behaving like this.
When I use the macro and then paste it somewhere else, I get 2 question marks inside a square box.
My string inside my macro is still correct. I checked with a msgbox at the end of the macro. So it is a problem with pasting to the clipboard.
Anyone have a solution for this? I use this macro all the time, it is reallt slowing me down now.
Thank you.
what it returns when pasting:
My code:
Public Sub copypath()
On Error Resume Next
Dim oselectcount As Long 'Aanpassing
Dim oprop1 As ComponentOccurrence 'Zorgt er voor dat in een assembly
Dim poprop2 As Document 'ook properties van onderliggende parts/assemblys
Dim opropset As Document 'ingevuld kunnen worden
Dim ofilename As String 'om filenaam weer te geven op formulier
Set opropset = ThisApplication.ActiveDocument
oselectcount = ThisApplication.ActiveDocument.SelectSet.Count
odoctype = ThisApplication.ActiveDocumentType
'kijken of er iets geselecteerd is
If oselectcount <> 0 Then
Set oprop1 = ThisApplication.ActiveDocument.SelectSet.Item(1)
Set oprop2 = oprop1.Definition.Document
Set opropset = oprop2
odoctype = oprop1.DefinitionDocumentType
'Cmdlib.Enabled = True
End If
' filenaam weergeven op formulier
ofilename = opropset.FullFileName
Set MyData = New DataObject
MyData.SetText ofilename
MyData.PutInClipboard
End Sub
Solved! Go to Solution.