Share via

Registry problem with VBA

Anonymous
2010-07-03T05:29:13+00:00

Hi everybody,

I have an Excel Macro for writing values to the registry. It works fine in Excel 2007, but with Excel 2010 the registry does

not change and I don't get any errory message. Here is the code:

Sub Test()    RegKeySave "HKEY_CURRENT_USER\foo\bar", Now, "REG_SZ" End Sub Sub RegKeySave(i_RegKey, i_Value, i_Type)    CreateObject("WScript.Shell").RegWrite i_RegKey, i_Value, i_Type End Sub

Any ideas ?

Thanks in advance !

Regards 

Markus


Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

10 answers

Sort by: Most helpful
  1. Anonymous
    2010-07-04T06:25:08+00:00

    Just for reference your original code writes to the registry here using 32bit Excel 2010 and 32 bit Windows 7 Ultimate.


    John Wilson PowerPoint MVP PowerPoint Alchemy

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2010-07-04T04:10:09+00:00

    Hi Tushar,

    Thanks for your answer.

    I've just tried out SaveSetting, but I'am still getting the same result: in Excel 2007 it works, but not in Excel 2010 !

    Regards Markus

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2010-07-03T21:51:13+00:00

    In VBA whenever I've wanted to save something in the registry I've used the VB functions: SaveSetting, GetSetting, DeleteSetting, and GetAllSettings.

    Might be something you want to explore.


    Tushar Mehta (Technology and Operations Consulting)

    www.tushar-mehta.com (Excel and PowerPoint add-ins and tutorials)

    Microsoft MVP Excel 2000-Present

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2010-07-03T18:34:20+00:00

    Hi there,

    thanks for your answer. I have Windows 7 and Office both on 32-bits !

    Regards Markus

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2010-07-03T11:30:48+00:00

    Could this be a 32bit versus 64bit issue? If your Windows 7 installation is 64-bit and your Office installation is 32-bits, the key needs to be written somewhere inside the WOW64 section of the registry.

    Was this answer helpful?

    0 comments No comments