Results 1 to 9 of 9

Thread: Marking an excel file with a key from system

  1. #1

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,116

    Question Marking an excel file with a key from system

    I would like to be be able to mark an excel file with a key which will come from the system so that when an excel file is imported it would try to find that key to determine if the file came from the system or not. I am currently doing it by specifying the key in the file name but that is very easy to fail. My google-fu is not working, my search results are returning links to adding keys/identification to the cells.

    In the VB.Net section it was recommended that I use a custom property of the excel file. I am still looking for other more foolproof ways if possible. Would it be possible to binary edit the file and include a secret data?

    TIA
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  2. #2
    PowerPoster
    Join Date
    Jun 2013
    Posts
    6,171

    Re: Marking an excel file with a key from system

    Excel files these days are Zip-Archives - they just have a different file-suffix than *.zip.

    So, use your Zip-lib of choice, open the Archive, place your "marker-key-file" somewhere - and the problem is solved.

    Olaf

  3. #3

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,116

    Re: Marking an excel file with a key from system

    Wow, that is very interesting, indeed I was able to add a file to the xlsx file using winrar and able to see it after opening it again. Will look further on how I can integrate this, thanks for the tip!
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  4. #4
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    3,320

    Re: Marking an excel file with a key from system

    Why not use the Keyword-Property of the Workbook?
    Go to File-Explorer, choose a xlsx-file, right-click on it, go to Properties, go to Details
    There you'll find different Properties (Author, Title, Subject etc.)
    Choose the appropriate one (German Windows for me, third from above should be "Keywords"

    You can read those from vb-code (tested in Office-VBA --> Debug.Print ThisWorkbook.Keywords)
    Or in your vb6-code oben the Object-Explorer and look for the Workbook-Object.
    You'll find all those Properties there

    if your Excel-Files come from the system (is system = your code?), set the keyword when creating the file, and you're all set
    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  5. #5
    Member
    Join Date
    May 2021
    Posts
    32

    Re: Marking an excel file with a key from system

    The suggestions above are likely the most straight-forward (and to easy to implement) solutions, but I thought I'd just throw into the mix the method detailed in Chip Peason's blog about writing and reading built-in and custom properties to closed files (). Of course, it requires the use of an additional DLL from Microsoft - DSO OLE Document Properties Reader 2.1 - so is not always appropriate in all scenarios, but I hoped it might be of value to someone.

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Posts
    23,658

    Re: Marking an excel file with a key from system

    This scenario seems totally bizarre.

    But assuming it makes any sense at all... why not just write some crap of your choice into an alternate data stream of the file?

  7. #7
    PowerPoster
    Join Date
    Jun 2013
    Posts
    6,171

    Re: Marking an excel file with a key from system

    Quote Originally Posted by dilettante View Post
    This scenario seems totally bizarre.
    It's not that bizarre IMO.

    Sometimes you want to have such documents passed through some (semi-)automated workflow-stages
    (partly system, partly human - and for the "system-parts" you need something that "keeps track").

    Quote Originally Posted by dilettante View Post
    But assuming it makes any sense at all... why not just write some crap of your choice into an alternate data stream of the file?
    AFAIK, these are "NTFS-bound" - and won't survive:
    - storing them on USB-sticks (which are still often enough FAT- or FAT32-formatted)
    - or (more likely) - transferring them via Sockets (upload/downloads - or EMail)
    - even the simple act of placing them in a Zip, would strip these DataStreams

    Olaf

  8. #8
    PowerPoster
    Join Date
    Feb 2006
    Posts
    23,658

    Re: Marking an excel file with a key from system

    So "detect if from this computer" except when not from this computer???

    Wouldn't you want your "this computer" marker scrubbed whenever the file travels?

  9. #9

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,116

    Re: Marking an excel file with a key from system

    Quote Originally Posted by dilettante View Post
    So "detect if from this computer" except when not from this computer???

    Wouldn't you want your "this computer" marker scrubbed whenever the file travels?
    No one said about "detect if from this computer", I said I wanted to know if the excel file was generated from the system and it should be identifiable if it is imported to the system. System = software/program.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

Posting Permissions

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



Click Here to Expand Forum to Full Width