Solved

Registry interaction syntax

Posted on 1998-07-10
4
147 Views
Last Modified: 2012-05-04
I'm a novice VB programmer and I'm having trouble reading in a registry key value.  What I'm trying to achieve is to read in a string value located in:

HKEY_LOCAL_MACHINE\SOFTWARE\MyCompany\ApplicationName

This value specifies a drive letter.

Here is the syntax I'm trying to use:
G_Current_Drive =
GetSetting( "HKEY_LOCAL_MACHINE\SOFTWARE\Creativeware", "Job Start", "InitDrive")

where G_Current_Drive is a global string variable.

After the user selects another drive letter, I want the program to update the value in the registry, so when the user runs the application and has to choose a drive letter again, it goes back to the last drive letter they were in.

I'm trying to use the "GetSetting" function to retrieve this key, but I can't seem to get it to work.  Am I on the right track?  I would be grateful for any advice or solutions.  Thanks in advance.
0
Comment
Question by:hwilson
  • 3
4 Comments
 

Author Comment

by:hwilson
Comment Utility
Edited text of question
0
 

Author Comment

by:hwilson
Comment Utility
Edited text of question
0
 
LVL 6

Accepted Solution

by:
alamo earned 100 total points
Comment Utility
The GetSetting keyword doesn't allow access to the entire registry - only HKEY_CURRENT_USER\Software\VB and VBA Program Settings\appname\section\key
and thus the hierarchical keys you specify won't work.

there is a Knowledge Base article which describes how to do this, with examples. See it on the web at http://support.microsoft.com/support/kb/articles/q145/6/79.asp If you need more details or have questions on any of this, just ask.

Hope this helps!
0
 

Author Comment

by:hwilson
Comment Utility
I found the answer at the exact same URL.  Thanks though.

Herbie
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now