+ Reply to Thread
Results 1 to 7 of 7

Automatically open, close & saved documents

  1. #1
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Automatically open, close & saved documents

    Hi all,

    I need your assistance to help me to open, close & saved a database file.
    Below is the VB Script ,
    Thank you in advance

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Automatically open, close & saved documents

    Hi,

    The following will probably do what you want, but has no error checking.
    Please Login or Register  to view this content.
    For an example of some of the same code with extensive error checking see post #3 or post #5 from http://www.excelforum.com/excel-gene...ta-weekly.html

    Lewis

  3. #3
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Automatically open, close & saved documents

    Dear Lewis,

    Thank you for your reply, but
    can this script combined with my "updatelogworksheet"? because I want the
    file open & after update it'll closed & saved by itself... thanks again

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Automatically open, close & saved documents

    namialus,

    Try this. It opens the file, runs your macro code, then saves and closes the file.

    Lewis

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Automatically open, close & saved documents

    Dear Lewis,

    I received error "run-time error 9 ; subscript out of range"
    & yellow mark at script line :

    Set inputWks = Worksheets("source")

    Note : The database file opened but no input ...

    Thank you again

  6. #6
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Automatically open, close & saved documents

    I didn't test the macro the first time because I didn't think anything could go wrong, go wrong, go wrong. I was misinformed. I apologize.

    I had to move the item in blue to the beginning of the macro. The macro was looking for Sheet 'source' in the wrong workbook.

    Try again with:
    Please Login or Register  to view this content.
    Lewis

  7. #7
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Automatically open, close & saved documents

    Dear Lewis,

    The macro working , thank you very much

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Look for and Open saved workbook retrieve information into new WB then close them
    By Aeneren in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-27-2012, 10:42 PM
  2. Macro to close down word and re-open a previously saved document
    By snoopy1461 in forum Word Programming / VBA / Macros
    Replies: 1
    Last Post: 01-20-2011, 09:59 AM
  3. Save an open workbook, then open template workbook and close the saved workbook
    By ondvirg in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-27-2009, 10:20 PM
  4. Open saved projects automatically?
    By Stuhump3 in forum Excel General
    Replies: 1
    Last Post: 09-09-2005, 03:05 PM
  5. How do I automatically open linked documents in Excel?
    By DroKoz in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 06-28-2005, 12:05 PM

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