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?
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
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?
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 theCode:If fs.FileExists
IF EXIST filename (
del filename
) ELSE (
echo filename missing.
)