Re: Prompt to overwrite file




"Bill Mosca, MS Access MVP" <billmosca@xxxxxxxxxx> wrote in message
news:OJWX6fAwIHA.1240@xxxxxxxxxxxxxxxxxxxxxxx
Alex, Tom

Thank you for the detailed response. I may not be able to get to the
user's
machine for a few days due to her schedule but there are things I can give
you.

I think I might have found the problem in the unzip function, but I'll let
you all take a look. This If block is written incorrectly (Note the
closing
paren is in the wrong place on line 3). That might be causing the delete
to
fail. The unzip uses Shell which I forgot all about until now.

'Kill file if any exists.
1 For Each varItem In oApp.Namespace(varZipFile).items
2 If fs.FileExists(varTargetFolder & varItem.Name) = True Then
3 fs.DeleteFile(varTargetFolder & varItem.Name), True
4 End If
5 Next



(1) The script:

'***************************************************************************
****
' Project : Financial Reporting System 3000 (FRS3000) (Access 2000)
'
' Title : FRS_FEUpdate
' DateTime : 12/14/2007 11:12:20
' Author : Bill Mosca
' Code for splash screen taken from example by Tom Lavedas.
' Purpose : Installs all files needed for database application based on
text
' file named FRS3000_feVyyyymmdd.txt
' Index :(Updated on 12/14/2007)
' MakeFEShortcut - Creates/overwrites shortcut to launch
' GetDB - Copy latest files from server to local folder
' Unzip - Unzips file
' KeyExists - Checks that msAccess key exists in registry

'***************************************************************************
****

Option Explicit
Const cTXTFILE = "FRS3000_feV20080519.txt"
Const cSVRPATH = "\\MyServer\SharedFolder"
Const cLOCPATH = "C:\FRS3000"
Const cFE = "FRS3000_FE.MDE"
Const cWrkGrp = "FRS3000.MDW"
Const cZip = "FRS3000_FE.zip"
Const cICON = "FRS3000.ICO"
Const cSCName = "StartFRS3000"
snip...

Sub main()
'Splash screen to let user know something is going on.
Call SplashBox("Project Management")

Set WSHShell = WScript.CreateObject("WScript.Shell")
Set fs = WScript.CreateObject("Scripting.FileSystemObject")

'See if latest text file is in local folder
If fs.FileExists(cLOCPATH & "\" & cTXTFILE) = False Then
On Error Resume Next
fs.DeleteFile(cLOCPATH & "\" & "FRS3000_feV*.txt")
Call GetDB
End If


'Just in case we need a new FE shortcut...
If MakeFEShortcut = False Then
Set fs = Nothing
Set WSHShell = Nothing
WSCRIPT.QUIT(0)
Exit Sub
End If
'Launch FE.
WSHShell.Run cLOCPATH & "\" & cSCName & ".lnk"

oIE.Quit
set oIE = Nothing

Set fs = Nothing
Set WSHShell = Nothing
WSCRIPT.QUIT(0)
End Sub


'***************************************************************************
****
'VBScript Starting point
Call main

'***************************************************************************
****

(2) Shortcut name: FRS 3000.lnk
Script file name: FRS3000_FEUpdate.vbs

What exactly does C:\FRS3000\StartFRS3000.lnk do?

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)


.



Relevant Pages


Loading