+ Reply to Thread
Results 1 to 4 of 4

Close document and Clear data

  1. #1
    Registered User
    Join Date
    11-12-2008
    Location
    Iowa
    Posts
    32

    Close document and Clear data

    I have a couple of questions here:

    I created an excel doc where the user inputs certain data. The input fields are concatenated as per the requirements of the final deliverable. Then, when the user hits "Submit", the macro that i wrote copies the entire text, opens a word document, pastes the text there and saves the new word document.

    Here are my 2 questions:

    1. How can I automatically close word after the documents are created? I did appWD.Documents.Close but that only closes the document, but MS word is still open.

    2. When the user exits excel, I want that the information they entered not be saved, so that when the next person goes in, they see an empty form which they fill out. How can I clean out that information?

    Please help. Thank you.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Close document and Clear data

    1) Maybe:
    Please Login or Register  to view this content.


    2) Maybe this in the ThisWorkbook module of the workbook that holds your form:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    11-12-2008
    Location
    Iowa
    Posts
    32

    Re: Close document and Clear data

    Thanks, I'll try the ThisWorkbook solution and let you know. I tried the appWD.close and it threw me an error.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Close document and Clear data

    I typically use a set of standard commands for opening an Word application instance and later closing it:
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1