users not running MS Access

teel73

Registered User.
Local time
Today, 02:03
Joined
Jun 26, 2007
Messages
205
I have a vba program that runs from an autoexec macro then quits the application. Some of the users don't have MS Access though. Is there a way users can run this program without having MS Access installed on their machines?
 
I have a vba program that runs from an autoexec macro then quits the application. Some of the users don't have MS Access though. Is there a way users can run this program without having MS Access installed on their machines?

You need to have some version of Access installed on there machine, either the full version or the runtime should work.
 
at least you need the runtime version of access.
 
ok. thank you. now is there a way I can create a vb script in notepad?
 
you can create a vb script file in any editor you wish, however, you must execute it within a host environment such as Windows Script Host or Internet Explorer.
 
Last edited:
thanks maxmangion. but I meant to ask if you can create VBA script using notepad and execute that? I'm sorry.
 
Hi,

as i have said in my previous post, you can create it with notepad, but you cannot directly run it from notepad.

you can execute it via Windows Script Host or Internet Explorer
 
I'm having a problem executing this script. I put the following code in a notepad file and saved the file as "hosts.vb". I clicked on the file and it didn't do anything. How do I execute that code. from my file?

Code:
Dim OldName As String, NewName As String
Dim fs As Object
Dim SourceFile, DestinationFile As String
 
Set fs = CreateObject("Scripting.FileSystemObject")
Kill "C:\WINDOWS\system32\drivers\etc\HOSTS"
 
'SourceFile = "[URL="file://\\Fanniemae.com\corp\DC\Shared\CSS\PSoft\HOSTS"]\\Fanniemae.com\corp\DC\Shared\CSS\PSoft\HOSTS[/URL]"
SourceFile = "[URL="file://\\ccure_server\badging\filechange\HOSTS"]\\ccure_server\badging\filechange\HOSTS[/URL]"
DestinationFile = "C:\WINDOWS\system32\drivers\etc\HOSTS"
FileCopy SourceFile, DestinationFile
 
I'm having a problem executing this script. I put the following code in a notepad file and saved the file as "hosts.vb". I clicked on the file and it didn't do anything. How do I execute that code. from my file?

Code:
Dim OldName As String, NewName As String
Dim fs As Object
Dim SourceFile, DestinationFile As String
 
Set fs = CreateObject("Scripting.FileSystemObject")
Kill "C:\WINDOWS\system32\drivers\etc\HOSTS"
 
'SourceFile = "[URL="file://\\Fanniemae.com\corp\DC\Shared\CSS\PSoft\HOSTS"]\\Fanniemae.com\corp\DC\Shared\CSS\PSoft\HOSTS[/URL]"
SourceFile = "[URL="file://\\ccure_server\badging\filechange\HOSTS"]\\ccure_server\badging\filechange\HOSTS[/URL]"
DestinationFile = "C:\WINDOWS\system32\drivers\etc\HOSTS"
FileCopy SourceFile, DestinationFile

I think a script is overkill for your needs, all you're doing is deleting then copying a file. How about just a simple batch file

Code:
DEL /F "C:\WINDOWS\system32\drivers\etc\HOSTS"
COPY  "[URL="file://ccure_server/badging/filechange/HOSTS"]\\ccure_server\badging\filechange\HOSTS[/URL]" "C:\WINDOWS\system32\drivers\etc\HOSTS"
 
thanks but that's my problem. I have no idea how to write the batch file, what to save it as, and how to run it and where to run it from. Do I save the text file with an extension of .bat? Then just click on the .bat file?
 
thanks but that's my problem. I have no idea how to write the batch file, what to save it as, and how to run it and where to run it from. Do I save the text file with an extension of .bat? Then just click on the .bat file?

I don't think notepad will let you save the file as .BAT but just save it as .TXT and change the extension manually. Double clicking on a .BAT file will execute it. The two lines I provided you should be all you need to put into the file.
 
Wow thanks!!!! is that vb or dos language you're using? How do I check to see if the file exits? Like in my vba code I use the
Code:
If fs.FileExists
 
the commands which Djkarl suggested are dos commands, and as he said it is much simpler running the batch file rather than a vb script.

I hope it is a good host file you're trying to replace:p
 
Wow thanks!!!! is that vb or dos language you're using? How do I check to see if the file exits? Like in my vba code I use the
Code:
If fs.FileExists

The DOS command would be something like

Code:
IF EXIST filename (
    del filename
    ) ELSE (
        echo filename missing.
        )

The echo just prints some text on the screen, you could change this to an exit command if you want to abort the process if the file is missing.
 

Users who are viewing this thread

Back
Top Bottom