+ Reply to Thread
Results 1 to 2 of 2

VBA code to change registry value of existing DSN

  1. #1
    Alan
    Guest

    VBA code to change registry value of existing DSN

    Hello,

    I need VBA code to change the DBQ string in an existing DSN.

    I am getting external data into Excel through a third party ODBC driver,
    and would like to emulate a DSN-less connection to the data by simply
    changing the DBQ string of an existing DSN. It's not really DSN-less,
    but the user will never know, and it would allow the user to get to
    external data residing in different folders without the mess of creating
    DSNs.

    I have accomplished the DBQ string change manually using regedit, and
    successfully brought data into Excel from different folders using the
    same DSN.

    I want to pass the DBQ string (path) from a variable that captures the
    string from the user's choice of filename through the GetOpenFileName
    dialog. I already have this piece complete.

    The DSN is in HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.INI\
    The DSN is: AnyEstimate-DoNotDelete

    Current DBQ string is: K:\Proposal\123.0403\ESTIMATR

    I am looking for a short, neat solution that will pass a different
    string from a VBA variable to the registry.

    Any help is much appreciated. Thanks in advance.

    *** Sent via Developersdex http://www.developersdex.com ***

  2. #2
    Tom Ogilvy
    Guest

    Re: VBA code to change registry value of existing DSN

    http://tinyurl.com/9pfoo

    should get you some sample code.

    --
    Regards,
    Tom Ogilvy


    "Alan" <anonymous@devdex.com> wrote in message
    news:OY79jKB1FHA.2932@TK2MSFTNGP10.phx.gbl...
    > Hello,
    >
    > I need VBA code to change the DBQ string in an existing DSN.
    >
    > I am getting external data into Excel through a third party ODBC driver,
    > and would like to emulate a DSN-less connection to the data by simply
    > changing the DBQ string of an existing DSN. It's not really DSN-less,
    > but the user will never know, and it would allow the user to get to
    > external data residing in different folders without the mess of creating
    > DSNs.
    >
    > I have accomplished the DBQ string change manually using regedit, and
    > successfully brought data into Excel from different folders using the
    > same DSN.
    >
    > I want to pass the DBQ string (path) from a variable that captures the
    > string from the user's choice of filename through the GetOpenFileName
    > dialog. I already have this piece complete.
    >
    > The DSN is in HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.INI\
    > The DSN is: AnyEstimate-DoNotDelete
    >
    > Current DBQ string is: K:\Proposal\123.0403\ESTIMATR
    >
    > I am looking for a short, neat solution that will pass a different
    > string from a VBA variable to the registry.
    >
    > Any help is much appreciated. Thanks in advance.
    >
    > *** Sent via Developersdex http://www.developersdex.com ***




+ 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