Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA code to change registry value of existing DSN

http://tinyurl.com/9pfoo

should get you some sample code.

--
Regards,
Tom Ogilvy


"Alan" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Really need help with existing code. Cam Excel Discussion (Misc queries) 0 August 12th 08 07:14 PM
Change default chart option in registry Jaylin Charts and Charting in Excel 1 August 14th 07 01:39 PM
Help with existing code ploddinggaltn Excel Discussion (Misc queries) 1 November 27th 06 09:46 PM
excel macro code in registry Jorge[_3_] Excel Programming 1 October 10th 03 06:33 PM
Code for existing links Sandy[_3_] Excel Programming 3 July 15th 03 07:42 PM


All times are GMT +1. The time now is 08:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"