none
Alert me Help with a Winword Macro RRS feed

  • Question

  • I am a novice but I have made this macro with Googling. I create a document in a folder and give it a name.  I then have to upload this document into a folder where I require the document name.  I want the document name in the end without doc extension for me to copy-paste in a folder.

    Dim NewPath As String
        
        NewPath = "C:\****\"
        ActiveDocument.SaveAs FileName:=NewPath & ActiveDocument.Name


        Dim myRange As Range

        Set myRange = ActiveDocument.Range
        myRange.Collapse Direction:=wdCollapseEnd
        myRange.InsertAfter ActiveDocument.Name
        MsgBox "This document's name is " & myRange.Text
        myRange.Copy
        ActiveDocument.Save
        ActiveWindow.Close

    Thanks in advance.

    Friday, December 21, 2018 10:07 PM

All replies

  • Hi,

    This is the forum to discuss questions and feedback for Microsoft Office features, I'll move your question to the MSDN forum for Word

    https://social.msdn.microsoft.com/Forums/en-US/home?forum=worddev

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    Regards,

    Emi


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Monday, December 24, 2018 3:29 AM