vbscript in Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all

I'm using the FileSystemObject.OpenTextFile method in VBA. I was wondering if there was a way that where ever this application is run it will create the text file there? I guess kinda like the Server.Mappath in ASP

Thanks
Rodney
 
Hi,
Something like:
?CurrentProject.Path

If you type the above in the Immediate window (press ctl-G)
you'll see the results.

--
HTH
Dan Artuso, MVP


rodneys said:
Hello all,

I'm using the FileSystemObject.OpenTextFile method in VBA. I was wondering
if there was a way that where ever this application is run it will create
the text file there? I guess kinda like the Server.Mappath in ASP.
 
I couldn't find anything on CurrentProject.Path but I did fin

Dim WshShel
Set WshShell = WScript.CreateObject("WScript.Shell"
WScript.Echo WshShell.CurrentDirector

when I run this in a vbscript by itself it works great, but if I run this thru VBA it always points to My Documents no matter where the Access application runs. Any ideas why this might be

Thanks
Rodney
 
Hi Rodney,

In recent versions of Access, CurrentProject.Path will give you what I
think you're asking for. In earlier versions, you need to get
CurrentDB.Name and parse the folder name out of it.
 
error with vbs: Set WSHShell = CreateObject("WScript.Shell"
RegLoc = "HKEY_LOCAL_MACHINE\Software\Motive\SmartBridge\Settings\Vendor
VendorName = WSHShell.RegRead(RegLoc)
 
Back
Top