Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

registry 1

Status
Not open for further replies.
Sep 22, 1999
76
US
Does any one know an easy way to modify regisrty values via vba
 
Go this out of Visual Basis 6 Pro Help<br>---------------------------------------------<br>Retrieving Application Settings<br><br><br>You can use the GetSetting and GetAllSettings functions to retrieve registry values stored in your application's registry location. For example, your application can retrieve registry settings to recreate its condition at the time it was closed.<br><br>One Setting at a Time<br>To retrieve a single registry setting, use the following syntax for the GetSetting function:<br><br>GetSetting(appname, section, key[, default])<br><br>The following code retrieves the value of the LastEntry key in the &quot;RegCust&quot; application's Startup section, and displays the value in the Immediate window.<br><br>Private Sub Form_Load()<br>&nbsp;&nbsp;&nbsp;Dim intLastEntry As Integer<br>&nbsp;&nbsp;&nbsp;intLastEntry = GetSetting(&quot;RegCust&quot;, &quot;Startup&quot;, _<br>&nbsp;&nbsp;&nbsp;&quot;LastEntry&quot;, &quot;0&quot;)<br>&nbsp;&nbsp;&nbsp;Debug.Print intLastEntry<br>End Sub<br><br>Note that you can use the optional parameter, default, to set the value returned by Visual Basic when there is no value listed in the registry for the specified key.<br><br>Multiple Settings<br>To retrieve a list of registry keys and their values, use the following syntax for the GetAllSettings function:<br><br>GetAllSettings(appname, section)<br><br>The following code retrieves a two-column list of registry keys and their values in the &quot;RegCust&quot; application's Startup section, and displays the results in the Immediate window.<br><br>Private Sub Form_Load()<br>&nbsp;&nbsp;&nbsp;Dim avntSettings As Variant<br>&nbsp;&nbsp;&nbsp;Dim intX As Integer<br>&nbsp;&nbsp;&nbsp;avntSettings = GetAllSettings(&quot;RegCust&quot;, &quot;Startup&quot;)<br>&nbsp;&nbsp;&nbsp;For intX = 0 To UBound(avntSettings, 1)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Debug.Print avntSettings(intX, 0), _ <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;avntSettings(intX, 1)<br>&nbsp;&nbsp;&nbsp;Next intX<br>End Sub<br><br>For More Information&nbsp;&nbsp;&nbsp;See &quot;GetSetting Function&quot; and &quot;GetAllSettings Function.&quot;<br>------------------------------------------- <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
thanks for the info how would you modify the registry values<br>
 
Visual Basic provides a standard registry location for storing program information for applications created in Visual Basic:<br><br>HKEY_CURRENT_USER\Software\VB and VBA Program Settings\appname\section\key<br><br>Visual Basic also provides four statements and functions to manipulate the settings stored in your application's registry location.<br><br>Function or Statement Description <br>GetSetting function Retrieves registry settings. <br>SaveSetting statement Saves or creates registry settings. <br>GetAllSettings function Returns an array containing multiple registry settings. <br>DeleteSetting statement Deletes registry settings. <br><br><br>Note&nbsp;&nbsp;&nbsp;To view registry entries, use the Regedit application, included with Windows 95 and Windows NT.<br><br><br>----------------------------------------<br>Creating or Saving Application Settings<br><br><br>You can use the SaveSetting statement to save a new value for a registry key stored in your application's registry location. For example, you could add code to the Form_Unload event in the application's main form in order to preserve settings at shutdown, or in the Form_Unload event on an Options dialog box to update user preferences.<br><br>Use the following syntax for the SaveSetting statement:<br><br>SaveSetting appname, section, key, value<br><br>The following code saves new values for the Backup and LastEntry keys in the Startup section of the registry for an application named &quot;RegCust.&quot; This code assumes that the variables strDate and intLastEntry contain the new values.<br><br>Private Sub Form_Unload(Cancel As Integer) <br>&nbsp;&nbsp;&nbsp;SaveSetting &quot;RegCust&quot;, &quot;Startup&quot;, &quot;Backup&quot;, strDate<br>&nbsp;&nbsp;&nbsp;SaveSetting &quot;RegCust&quot;, &quot;Startup&quot;, &quot;LastEntry&quot;, _<br>&nbsp;&nbsp;&nbsp;intLastEntry<br>End Sub<br><br>If an entry for the application &quot;RegCust&quot; or any of these sections or keys don't exist in the Software/Microsoft section in the registry, this code will create it.<br><br>-------------------- <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
DiscoDuane, did you manage to find a way of editting the registry. I am also at this cross road, With the distribution of my applications I include runtime2000. Yeserday I came across a machine that had access97 on it, not uncommon. The problem is that runtime2000 does not save itself as the default current version in the regestry this is a problem because I have automation procedure which opens the MDE file via and EXE file. What happens now is the EXE file believes the current versio is access97 and attmpts to open the MDE via it.

So what am i trying to do.

:(HKEY_CLASSES_ROOT, &quot;Access.Application\CurVer&quot;, &quot;&quot;)

at present the CurVer is set to access.application.8
which is access97 I need to change it so that it reads
access.application.9 as this is access2000

Dougp if you are still following this and have any ideas they would also be greatly appreatiated.

Thanks
Zero Anarchy

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top