What do you want to do with it when you have it on the clipboard?
--
Hope this helps,
Doug Robbins - Word MVP
dkr[atsymbol]mvps[dot]org
Dear Experts:
I would like to copy the path of the currently open file into the
clipboard using VBA, e.g. C:\test\MyDocument.doc.
I hope this is feasible.
Thank you very much in advance for your valuable help.
Regards, Andreas- Hide quoted text -
- Show quoted text -
thank you very much for your swift reply. I would like to paste the
string anywhere, such as a Word, Excel or PowerPoint document.
Based on the code inhttp://
www.word.mvps.org/FAQs/MacrosVBA/ManipulateClipboard.htm:
Sub CopyDocPath()
Dim MyData As DataObject
Dim strClip As String
strClip = ActiveDocument.FullName
Set MyData = New DataObject
MyData.SetText strClip
MyData.PutInClipboard
End Sub
In order to make this work, you MUST set a reference to the "Microsoft
Forms 2.0 Object Library" in the VBA editor by clicking Tools >
References and putting a check mark next to that item in the list.
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ:
http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroupso all may benefit.- Zitierten Text ausblenden -
- Zitierten Text anzeigen -