+ Reply to Thread
Results 1 to 3 of 3

VBA to compare revision number between 2 excel files - 1 open & 1 closed

  1. #1
    Registered User
    Join Date
    12-18-2014
    Location
    Croatia
    MS-Off Ver
    2013
    Posts
    24

    VBA to compare revision number between 2 excel files - 1 open & 1 closed

    Hi everyone!

    We are using templates on the network that user copies to their local computer, but every now and then we change to original file on the network, but the user forgets to copy it back to local computer.

    So is it possible (vba) that when the document is opened, it checks for the original file on the network (That has Revision number 00) and if it is the same, just proceed dok do anything, but if the revision number on the template is higher (example revision number 03) then warn the user to copy the original document again to their local computer??

    I only need it to check to revision number in document properties..

    Thank you in advance!

  2. #2
    Registered User
    Join Date
    12-18-2014
    Location
    Croatia
    MS-Off Ver
    2013
    Posts
    24

    Re: VBA to compare revision number between 2 excel files - 1 open & 1 closed

    Is it possbile that no one knows? I also searched Google, and havent found very useful links....

    http://www.mrexcel.com/forum/excel-q...-1-closed.html

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

    Re: VBA to compare revision number between 2 excel files - 1 open & 1 closed

    Hi kiki1989sb,
    I only need it to check to revision number in document properties.
    There is no 'Revision' document property. I included two sample User files, one that uses a 'Built In' Document property and one that uses a 'Custom' Document Property. See the attached .zip file which contains the following files:

    a. ExcelForumMasterRevisionNumberFile.xlsm - Simulates your master file. This file uses the 'Built In' Document Property 'Category' to store the Revision Number. This file also uses the 'Custom' Document Property 'Revision' to store the Revision Number. The 'Category' and 'Revision' values are different for demonstration purposes. If this file is run standalone, a message will be displayed showing the value of both properties.

    b. ExcelForumCompareDocumentRevisionNumbers.xlsm - This simulates the User File and uses 'Built In' Document Property 'Category' to store the Revision Number.

    c. ExcelForumCompareDocumentRevisionNumbersA.xlsm - This simulates the User File and uses 'Custom' Document Property 'Revision' to store the Revision Number.

    -------------------
    Both these files use Workbook_Open() to:
    a. Read the Revision Number from their own file.
    b. Open the Master File with Events disabled to prevent Workbook_Open() from runnning in the Master file.
    c. Read the Revision Number from the Master file.
    d. Close the Master file and enable Excel Events.
    e. Compare the Revision Numbers and display a message if the User File is out of date.
    f. If any errors occur (e.g. Master File is NOT AVAILABLE), it is assumed that the User file is current.

    ------------------------
    Workbook_Open() in ThisWorkbook module - common to both User Files:
    Please Login or Register  to view this content.
    Built In Document Proerrty 'Category'
    Contents of ExcelForumMasterRevisionNumberFile.xlsm ordinary code module ModCompareVersions:
    Please Login or Register  to view this content.
    Custom Document Property 'Revision'
    Contents of ExcelForumMasterRevisionNumberFileA.xlsm ordinary code module ModCompareVersions:
    Please Login or Register  to view this content.
    ------------------------
    The 'Master Folder Name' must be changed in the above macros to reflect the location of your Master Folder. If you use an Environment variable to locate the Master Folder, the code can be changed to use the Environment variable.


    To access 'Built In Document Properties':
    Excel 2003: File > Properties > Summary
    Excel 2010: File > Info > Properties > Advanced Properties > Summary


    To access 'Custom Document Properties':
    Excel 2003: File > Properties > Custom
    Excel 2010: File > Info > Properties > Advanced Properties > Custom

    Lewis
    Last edited by LJMetzger; 12-01-2015 at 09:43 AM.

+ 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. [SOLVED] Copy data from closed files into open worksheet
    By Eisoptrophobia in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-15-2015, 06:54 AM
  2. [SOLVED] Save/Closed only macro related files and leave unrelated files open in excel?
    By rdowney79 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-12-2013, 04:17 PM
  3. Replies: 0
    Last Post: 09-24-2013, 03:22 PM
  4. Revision Number in Excel?
    By JBeaucaire in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-13-2008, 02:29 AM
  5. Using INDIRECT function on closed files without having to open them
    By Cumberland in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-14-2007, 06:36 AM
  6. Replies: 4
    Last Post: 05-25-2006, 10:10 AM
  7. Compare name and copy from closed .csv files
    By Mikke in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-12-2006, 06:55 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