PC Review


Reply
Thread Tools Rate Thread

Capturing the name of a Word file while working with the file

 
 
Opinicus
Guest
Posts: n/a
 
      12th Jan 2009
Is there a way to capture the name of a Word document that I'm working with
while the file is open and I'm in the file? By sending it to the clipboard,
for example?

--
Bob
http://www.kanyak.com

 
Reply With Quote
 
 
 
 
p0
Guest
Posts: n/a
 
      12th Jan 2009
On 12 jan, 10:37, "Opinicus" <gez...@spamcop.net.which.is.not.invalid>
wrote:
> Is there a way to capture the name of a Word document that I'm working with
> while the file is open and I'm in the file? By sending it to the clipboard,
> for example?
>
> --
> Bobhttp://www.kanyak.com


The following macro might do the trick:

' === Begin of macro ===
Sub FileName()
Dim obj As DataObject

Set obj = New DataObject

obj.SetText ActiveDocument.Path & ActiveDocument.Name
obj.PutInClipboard
End Sub
' === End of macro ===

Yves
 
Reply With Quote
 
Graham Mayor
Guest
Posts: n/a
 
      12th Jan 2009
Capture it for what purpose? In order to best answer your question, we need
to know what you want to do with the name that you have 'captured'.


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Opinicus wrote:
> Is there a way to capture the name of a Word document that I'm
> working with while the file is open and I'm in the file? By sending
> it to the clipboard, for example?



 
Reply With Quote
 
Suzanne S. Barnhill
Guest
Posts: n/a
 
      12th Jan 2009
You can insert a FILENAME field in the document, if that's what you mean.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org

"Opinicus" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Is there a way to capture the name of a Word document that I'm working
> with while the file is open and I'm in the file? By sending it to the
> clipboard, for example?
>
> --
> Bob
> http://www.kanyak.com
>



 
Reply With Quote
 
Opinicus
Guest
Posts: n/a
 
      12th Jan 2009
"p0" <(E-Mail Removed)> wrote

>> Is there a way to capture the name of a Word document that I'm working
>> with
>> while the file is open and I'm in the file? By sending it to the
>> clipboard,
>> for example?


> The following macro might do the trick:
>
> ' === Begin of macro ===
> Sub FileName()
> Dim obj As DataObject
>
> Set obj = New DataObject
>
> obj.SetText ActiveDocument.Path & ActiveDocument.Name
> obj.PutInClipboard
> End Sub
> ' === End of macro ===


Thanks, Yves. This looks like it should do what I want but it chokes on the
first line (Dim obj) with a "User-defined type not identified" error. What
am I doing wrong?

--
Bob
http://www.kanyak.com

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Word file preview is not working Kenwyler Microsoft Word Document Management 1 3rd Mar 2010 04:53 AM
Lost Word '07 file that was working on in Word '03 hjneedshelp Microsoft Word Document Management 1 3rd Feb 2009 06:04 AM
Word why does working file save other file I have open instead? =?Utf-8?B?TGluZGFFdGhlTVQ=?= Microsoft Word Document Management 0 1st Sep 2007 12:22 AM
links from Word doc to ppt file not working? Geoff Cox Microsoft Powerpoint 6 29th Jul 2006 03:23 PM
File size differences when working with Word 97 vs Word 2002 =?Utf-8?B?UGFt?= Microsoft Word Document Management 1 8th Dec 2003 02:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:09 PM.