1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

Word Macro: Save as clipboard contents

Discussion in 'Other PC Software' started by kubrendan, 2005/05/18.

Thread Status:
Not open for further replies.
  1. 2005/05/18
    kubrendan

    kubrendan Inactive Thread Starter

    Joined:
    2005/05/18
    Messages:
    2
    Likes Received:
    0
    I apologize if this isn't the correct place to post this, but this was the only forum I could find on here that had questions about Word. I am trying to create a macro that would save the current document with the title as whatever the current contents of the clipboard are. In other words, I have a macro that will copy some text from the page, and I'd like to do a "save as" and title it whatever is copied to the clipboard. The normal way of doing a "save as" macro is:

    ActiveDocument.SaveAs FileName:= "test" ...

    Instead of the "test" part, I'd basically like to have a Selection.Paste. However, putting this command in there doesn't work. Can anyone tell me how to solve this?

    Thanks so much in advance!

    --Brendan--
    < "}}}}}><
     
  2. 2005/05/19
    Newt

    Newt Inactive

    Joined:
    2002/01/07
    Messages:
    10,974
    Likes Received:
    2
    Hi kubrendan.

    This is the place for Word questions. I'm still a little confused about what you want the macro to do though. Could you explain a little more and include your Word version.
     
    Newt,
    #2

  3. to hide this advert.

  4. 2005/05/19
    kubrendan

    kubrendan Inactive Thread Starter

    Joined:
    2005/05/18
    Messages:
    2
    Likes Received:
    0
    Thanks for the reply. I'm using Word 2000, although the macro needs to work in Word 97 as well.

    I currently have a macro that will take pieces of text from a page and copy them to the clipboard. What I want to do is have a macro that will do a save as and have the title be whatever text is contained on the clipboard. Does that make more sense?

    Thanks!

    --Brendan--
    < "}}}}}><
     
  5. 2005/05/20
    Newt

    Newt Inactive

    Joined:
    2002/01/07
    Messages:
    10,974
    Likes Received:
    2
    It does. I'm gonna have to think on this one and probably play around some so probably Monday if no one else has answered before then.
     
    Newt,
    #4
  6. 2005/06/09
    Manazer

    Manazer Inactive

    Joined:
    2005/06/09
    Messages:
    1
    Likes Received:
    0
    Solution:

    Selection.Copy
    ClipboardText = Selection
    ActiveDocument.SaveAs FileName:= ClipboardText & ".doc ", FileFormat:=wdFormatDocument

    (I supppose that you "filled clipboard" by sommand Selection, like in my case - I need copy text from line No. 5, 4th word without end space; Next macro code goes before "Selection.Copy ":
    Selection.HomeKey Unit:=wdStory
    Selection.MoveDown Unit:=wdLine, Count:=5
    Selection.HomeKey Unit:=wdLine
    Selection.MoveRight Unit:=wdWord, Count:=4
    Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend)

    Further questions? - Contact me: Removed
     
  7. 2005/06/09
    PeteC

    PeteC SuperGeek Staff

    Joined:
    2002/05/10
    Messages:
    28,896
    Likes Received:
    389
    Manazer - Welcome to the Board :)

    Many thanks for your input on this and for sharing your solution.

    Most unwise to publish your email address - I have removed it.
     
Thread Status:
Not open for further replies.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.