Results 1 to 8 of 8
  1. #1
    New Lounger
    Join Date
    Oct 2002
    Location
    Edmonton, Alberta, Canada
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Changes to Windows Registry (English/Word/97Windows/98)

    I have been saddled with the task to create a macro in VBA to change the International Date settings in the Windows Registry.

    I am not sure how to do this and the macro that I have tried keeps giving me errors - but I'm not sure what exactly I am doing wrong.

    I have to change the HKEY_USERS.DefaultControl PanelInternational
    to locale="0000409"
    sShortDate="MM/dd/yyyy"

    Can this be done? Does anyone have any suggestions as to what the code should be?

    Thank you

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Changes to Windows Registry (English/Word/97Windows/98)

    Hi,
    Try the following:
    <pre>Sub SetRegKeysTest()
    Dim WshShell
    Set WshShell = CreateObject("Wscript.shell")
    With WshShell
    .regwrite "HKEY_USERS.DEFAULTControl PanelInternationalLocale", _
    "00000809", "REG_SZ"
    .regwrite "HKEY_USERS.DEFAULTControl PanelInternationalsShortDate", _
    "dd/MM/yyyy", "REG_SZ"
    End With
    Set WshShell = Nothing
    End Sub

    </pre>

    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Changes to Windows Registry (English/Word/97Windows/98)

    Before you start mucking with the registry:

    <big>BACKUP YOUR REGISTRY</big>

    Did I mention:

    <big>BACKUP YOUR REGISTRY</big>

    Until today, I never bothered. But I have since had a change of heart. I was working on an installation program to install an Access Add-In. The install went smoothly, so I decided to try the uninstall.

    Well, one small typo in the uninstall script. Waht happened? I ripped half the registry out <img src=/S/crybaby.gif border=0 alt=crybaby width=15 height=15> . All because of one small, teenie, tiny, itty bitty typo.

    <img src=/w3timages/censored.gif alt=censored border=0> <img src=/w3timages/censored.gif alt=censored border=0> <img src=/w3timages/censored.gif alt=censored border=0> <img src=/w3timages/censored.gif alt=censored border=0> <img src=/w3timages/censored.gif alt=censored border=0> Now the <img src=/w3timages/censored.gif alt=censored border=0> laptop won't even boot into Win2K. I have to wait until I get home tonight to try and repair the installation enough so I can get my data off.

    <big>BACKUP YOUR REGISTRY</big>
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  4. #4
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Changes to Windows Registry (English/Word/97Windows/98)

    Hi Bryan,
    Have you tried restoring one of Windows' previous copies of the registry - with Win 98 it usually keeps at least 5, so I expect Win2K would do something similar. In Win 98, you'd boot to DOS and use:
    scanreg/restore
    Alternatively,
    scanreg/fix
    might work.

    Cheers
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  5. #5
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Changes to Windows Registry (English/Word/97Windows/98)

    Nope. It's <img src=/S/hosed.gif border=0 alt=hosed width=73 height=24>

    Not only does my prgramming suck sometimes, so does my timing. I managed to get it restored to an almost working condition when I started getting BSOD. It looks like the HD controller is going on it as well [img]/forums/images/smilies/sad.gif[/img]

    Trying to repair the Win2K install from CD says that my system doesn't have a HD in it.

    Chalk this one up to bad timing and bad luck.

    The only good thing about it is that I had most of my work elsewhere, so I didn't loose too much. Maybe 10 hours of work on one project and that's it.

    Live and learn.
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  6. #6
    New Lounger
    Join Date
    Oct 2002
    Location
    Edmonton, Alberta, Canada
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Changes to Windows Registry (English/Word/97Windows/98)

    It worked like a dream. Thank you very much for your expertise!!!!

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Changes to Windows Registry (English/Word/97Windows/98)

    You can't boot to DOS in Win2k. There is no DOS running under Windows NT and above. And if you have an NTFS boot disk, you cannot even boot from a DOS diskette and read the drive.
    Charlotte

  8. #8
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Changes to Windows Registry (English/Word/97Windows/98)

    Is there some reason you're trying to do this this way? An API call to RegSetValueEx, for example, would be a safer way to approach it.
    Charlotte

Posting Permissions

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