+ Reply to Thread
Results 1 to 12 of 12

Print Registry keys to a text file

  1. #1
    Forum Contributor
    Join Date
    08-23-2010
    Location
    Staten Island, NY
    MS-Off Ver
    Excel 2003
    Posts
    242

    Print Registry keys to a text file

    Is it possible to print certain Registry Keys to a Text File?

    Say I have this one:

    SaveSetting "BRT", "Company"

    and i want to print all the registry Keys that fall under that. How would I do that?

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Print Registry keys to a text file

    Why do you want to use the registry; are you familiar with customdocumentproperties ?



  3. #3
    Forum Contributor
    Join Date
    08-23-2010
    Location
    Staten Island, NY
    MS-Off Ver
    Excel 2003
    Posts
    242

    Re: Print Registry keys to a text file

    Actually I do not. Currently I use the Registry for saving user settings for my excel addin

  4. #4
    Forum Contributor
    Join Date
    08-23-2010
    Location
    Staten Island, NY
    MS-Off Ver
    Excel 2003
    Posts
    242

    Re: Print Registry keys to a text file

    Is this possible to do? I think it is - I just do not have any idea how I would do it.

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Print Registry keys to a text file

    Open workbook/ menu bar/ file/ properties/ tab 'adapte /adjuste'

    There you can store any information you want to store.

    in VBA :

    Please Login or Register  to view this content.
    Last edited by snb; 07-12-2011 at 11:41 AM.

  6. #6
    Forum Contributor
    Join Date
    08-23-2010
    Location
    Staten Island, NY
    MS-Off Ver
    Excel 2003
    Posts
    242

    Re: Print Registry keys to a text file

    I do not think that would help me because I create an add-in that multiple use on any workbook. So what I need to do is be able to print the Registry strings to a text file if possible.

  7. #7
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Print Registry keys to a text file

    I think you misunderstood me. The customdocumentproperties will be put into the addin.

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Print Registry keys to a text file

    Hello djblois1,

    While VBA provides the tools to save information to the registry, it does not provide a built-in method to retrieve the all values and theirs settings at once. Seems to be another of those "WTF were they thinking!" moments when you realize they did not include such a tool.

    All is not lost. I have created a macro that returns all the values and the settings for a registry key. A 1 dimensional zero based string array is returned that contains the value name, the registry data type (helpful if the data needs to converted back), and the data for each entry. Each section of the string is separated by a tab character, since this is rarely used in the registry.

    A second macro will print this information into a text file. You will need to change the file's path and file's name to what you want use. Due to length of this post, I have to post the second macro in a following post.

    Because this macro uses Windows API calls to the registry, please do not attempt to alter the code if it does not work. If you do change the code then you could crash the computer, corrupt the registry, and not be able to reboot.

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  9. #9
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Print Registry keys to a text file

    Hello djblois1,

    Here is the macro to print the registry vlaues and settings to a text file. Be sure to change the file's path and name (marked in bold) to what you will be using.

    Macro to Save Registry Values and Settings to a Text File
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 07-13-2011 at 12:59 AM.

  10. #10
    Forum Contributor
    Join Date
    08-23-2010
    Location
    Staten Island, NY
    MS-Off Ver
    Excel 2003
    Posts
    242

    Re: Print Registry keys to a text file

    snb,

    Just curious, will the Document properties save individually for each user? Also, can I read, write, and print from it easily?

  11. #11
    Forum Contributor
    Join Date
    08-23-2010
    Location
    Staten Island, NY
    MS-Off Ver
    Excel 2003
    Posts
    242

    Re: Print Registry keys to a text file

    Just bumping back up

  12. #12
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Print Registry keys to a text file

    To give an impression of creating, reading & changing a documentproperty in an AddIn.
    Assuming the AddIn "example.xla" has been loaded:

    Please Login or Register  to view this content.
    Last edited by snb; 07-15-2011 at 11:23 AM.

+ 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