Rabu, 02 Mei 2012

[MS_AccessPros] Re: Reading Registry For Trusted Location

 

Ha! Google is our friend! Take a look at this site:
http://www.robvanderwoude.com/regedit.php

Bill

--- In MS_Access_Professionals@yahoogroups.com, "D" <embreydl@...> wrote:
>
> Thanks Bill,
>
> This would help if I knew how to invoke it in our current process. As I stated, our install is done using a .bat file that copies a .lnk from the network drive to the user's desktop. That .lnk runs a .bat on the network drive that checks whether the user has Access 2003 or Access 2007. If the user has Access 2007, the accde file is copied to the C:\Users\<badgenbr>\<appfolder>\. That is the path the path we need to add as a trusted location during the install.
>
> I've found several references using Google to read the registry keys using batch file commands. But, I haven't found one that gives enough information for me to be able to apply it to my situation.
>
>
> Darrell
>
> --- In MS_Access_Professionals@yahoogroups.com, "Bill Mosca" <wrmosca@> wrote:
> >
> > Darrell,
> >
> > Here is a VBScript version:
> >
> > Function KeyExists(sKeyPath)
> > KeyExists = False: If (sKeyPath = "") Then Exit Function
> > On Error Resume Next
> > CreateObject("wscript.shell").RegRead sKeyPath
> > Select Case Err
> > Case 0: KeyExists = True
> > Case &H80070002: Dim sErrMsg
> > sErrMsg = Replace(Err.Description, sKeyPath, "")
> > Err.Clear
> > CreateObject("wscript.shell").RegRead "HKEY_ERROR\"
> > KeyExists = Not (sErrMsg = Replace(Err.Description, "HKEY_ERROR\", ""))
> > Case Else: KeyExists = False
> > End Select
> > On Error GoTo 0
> > End Function
> >
> >
> > That help?
> >
> > Regards,
> > Bill Mosca, Founder - MS_Access_Professionals
> > http://www.thatlldoit.com
> > Microsoft Office Access MVP
> > https://mvp.support.microsoft.com/profile/Bill.Mosca
> >
> >
> >
> > --- In MS_Access_Professionals@yahoogroups.com, "D" <embreydl@> wrote:
> > >
> > > Greetings All,
> > >
> > > My company is upgrading from Windows XP and Office 2003 to Windows 7 and Office 2007. We have many Access applications that we need to add the location of the local database to the trusted locations in order for the vba code to run without receiving the security warning. I've found a program, AddPath.exe, that will allow us to add the trusted location to prevent the user from having to intervene and add the path to the trusted locations.
> > >
> > > My question is, how can I read the registry to see if the registry key for the trusted location already exists. Obviously, if it already exists it doesn't need to be added. Most of our applications have the users execute a .bat file that creates the folder for the database on the local machine and copies the latest version of the database from a network drive.
> > >
> > > Thanks in advance for your help.
> > >
> > >
> > > Darrell
> > >
> >
>

__._,_.___
.

__,_._,___

Tidak ada komentar:

Posting Komentar