PC Review


Reply
Thread Tools Rate Thread

Delete old link from desktop

 
 
Cesar
Guest
Posts: n/a
 
      12th Sep 2008
To automatically download a link to launch an application once the user
login, I copy a new link to the desktop using the folowing line of code:
FileCopy BEPath & "\NewLink.lnk", "c:\Documents And Settings\All
Users\Desktop\NewLink.lnk"
My problem is I have not found a way to delete the old link from an earlier
manual installation, located in "c:\Documents And
Settings\CurrentUser\Desktop\", ending up having two links.
Is there a way to find out using VBA to find out who is the CurrentUser that
is logged in the machine?
I still can do it manually but I would prefer a more elegant solution.
 
Reply With Quote
 
 
 
 
Cesar
Guest
Posts: n/a
 
      12th Sep 2008
Terrific!
Thanks

"Chris O'C via AccessMonster.com" wrote:

> You can find the code here
>
> http://www.mvps.org/access/api/api0008.htm
>
> Chris
> Microsoft MVP
>
>
> Cesar wrote:
> >Is there a way to find out using VBA to find out who is the CurrentUser that
> >is logged in the machine?

>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/For...dules/200809/1
>
>

 
Reply With Quote
 
dch3
Guest
Posts: n/a
 
      13th Sep 2008
The following VB Script demonstrates how it can be used to copy a new front
end from a server to a local machine each time the user clicks on it and then
automatically start Access. From the user's perspective, they don't know any
difference. You can use the same technique in situations where the front end
might move around or you need to point the users to a different file.
Basically, use the script to create a shortcut on their desktop that points
to the script and then within the script make the neccessary changes. That
way you won't have to worry about deleting a shortcut if you move the front
end - just keep the script in the same location.

'--------------------------------------------------------------------------------------------
' Author : David C. Holley
' Date : 9/1/2008
' Purpose : Temporary startup script which backsup the local .MDE file (if
present) and then
' copies the current .MDE file from the server to the local
machine. Currently,
' there are two temp tables in the front end which can lead to
database bloat.
' Copying the front end each time its started is a temporary
stop-gap until I
' can spin out the temp tables to their own .MDB.
'--------------------------------------------------------------------------------------------
'10
Dim wshShell
Dim fso
Dim strMsgText
Dim strLocalTargetFolder
Dim strServerSourceFolder
Dim appIE
Dim ieWindow
'18
Set fso = createObject("Scripting.FileSystemObject")
Set wshShell = createObject("Wscript.shell")

'--------------------------------------------------------------------------------------------
Set appIE = CreateObject("InternetExplorer.Application")
appIE.Offline = True
appIE.AddressBar = False
appIE.Height = 200
appIE.Width = 350
appIE.MenuBar = False
appIE.StatusBar = False
appIE.Silent = True
appIE.ToolBar = False
appIE.Navigate ""
Do While appIE.Busy
WScript.Sleep 100
Loop
appIE.document.Open
Set ieWindow = appIE.document
ieWindow.Write "<html><head><title>"
ieWindow.Write "Microsoft Access"
ieWindow.Write "</title></head><body id='bodyTag' scroll=no
style=font-size:8pt;font-family:Tahoma;background-color:#D4D0C8>"
ieWindow.Write "<div style=font-weight:800;>"
strMsgText = ""
strMsgText = strMsgText & "The application will start momentarily.
Please wait while your PC is checked for the most current version." & Chr(13)
strMsgText = strMsgText & "There may be a short delay if files need to be
copied to your machine. Please wait.<br>"
ieWindow.write strMsgText
ieWindow.write "</div>"
ieWindow.Write "</body></html>"
appIE.Visible = True
'--------------------------------------------------------------------------------------------
'50
strLocalTargetFolder = "C:\\Documents and Settings\\All
Users\\Documents\\Trailer Management and Manifest\\Application"
strServerSourceFolder =
"P:\\Orlando\\Branch\\Data\\Production\\Operations\\Trailer Management and
Manifest\\Application"

ieWindow.GetElementById("bodyTag").innerHTML =
ieWindow.GetElementById("bodyTag").innerHTML & "<br>-Checking local
folders..."

'Create the folders if they don't exist
call createLocaLFoLders
'58
ieWindow.GetElementById("bodyTag").innerHTML =
ieWindow.GetElementById("bodyTag").innerHTML & "<br>-Local folders exist..."
ieWindow.GetElementById("bodyTag").innerHTML =
ieWindow.GetElementById("bodyTag").innerHTML & "<br>-Copying Front End .MDE
file to local machine..."

'Copy the front end to the hard drive, overright if it already exists
fso.copyfile strServerSourceFolder & "\\Trailer Management and Manifest
Front End.mde", strLocalTargetFolder & "\\Trailer Management and Manifest
Front End.mde", true

ieWindow.GetElementById("bodyTag").innerHTML =
ieWindow.GetElementById("bodyTag").innerHTML & "<br>-Checking desktop
shortcut..."

createShortcut

'Copy the short cut to this script if it doesn't exist
fso.copyfile strServerSourceFolder & "\\Start Trailer Management and
Manifest Database.lnk", "C:\\Documents and Settings\\All
Users\\Desktop\\Start Trailer Management and Manifest Database.lnk", true
'71
ieWindow.GetElementById("bodyTag").innerHTML =
ieWindow.GetElementById("bodyTag").innerHTML & "<br>-Starting Access..."

wshShell.run "Msaccess.exe " & chr(34) & strLocalTargetFolder & "\\Trailer
Management and Manifest Front End.mde" & Chr(34)

appIE.quit

Set IEwindow = Nothing
Set appIE = nothing
Set wshShell = Nothing
Set fso = nothing
'82
sub createLocaLFoLders

Dim targetFolder
Dim folderExists
'87
targetFolder = "C:\\Documents and Settings\\All Users\\Documents\\Trailer
Management and Manifest"
folderExists = FSO.FolderExists(targetFolder)
'90
if folderExists = False then
fso.CreateFolder targetFolder
end if
targetFolder = "C:\\Documents and Settings\\All
Users\\Documents\\Trailer Management and Manifest\\Application"
'95
folderExists = FSO.FolderExists(targetFolder)

if folderExists = False then
fso.CreateFolder targetFolder
end if

end sub
'103
sub createShortcut

aSplit = split(wscript.scriptname, ".")
if Not fso.fileExists (aSplit(0) & ".lnk") then
set newShortcut = wshShell.createShortcut (strServerSourceFolder & "\\" &
aSplit(0) & ".lnk")
newShortcut.TargetPath = WScript.ScriptFullName
newShortCut.WorkingDirectory = strServerSourceFolder
newShortcut.IconLocation = "C:\Program Files\Microsoft
Office\OFFICE11\\msaccess.exe, 0"
newShortCut.Description = "Start Trailer Management and Manifest
Database"
newShortCut.Save
end if

end sub






"Cesar" wrote:

> To automatically download a link to launch an application once the user
> login, I copy a new link to the desktop using the folowing line of code:
> FileCopy BEPath & "\NewLink.lnk", "c:\Documents And Settings\All
> Users\Desktop\NewLink.lnk"
> My problem is I have not found a way to delete the old link from an earlier
> manual installation, located in "c:\Documents And
> Settings\CurrentUser\Desktop\", ending up having two links.
> Is there a way to find out using VBA to find out who is the CurrentUser that
> is logged in the machine?
> I still can do it manually but I would prefer a more elegant solution.

 
Reply With Quote
 
dch3
Guest
Posts: n/a
 
      13th Sep 2008
oh and you can set up a VB Script to run at login to copy the shortcut to the
desktop when the user logs in and conditionally check to see if exists prior
to doing so.

Google - WINDOWS SCRIPT HOST

"Cesar" wrote:

> To automatically download a link to launch an application once the user
> login, I copy a new link to the desktop using the folowing line of code:
> FileCopy BEPath & "\NewLink.lnk", "c:\Documents And Settings\All
> Users\Desktop\NewLink.lnk"
> My problem is I have not found a way to delete the old link from an earlier
> manual installation, located in "c:\Documents And
> Settings\CurrentUser\Desktop\", ending up having two links.
> Is there a way to find out using VBA to find out who is the CurrentUser that
> is logged in the machine?
> I still can do it manually but I would prefer a more elegant solution.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Internet explorer does not open a link from Outlook or other link from the desktop... Luka Manojlovic Windows XP General 1 15th Sep 2007 01:25 AM
Please Help - Desktop Link Automatically Shows on Desktop =?Utf-8?B?Q3JhaWcgUw==?= Windows XP General 2 13th Dec 2005 07:13 PM
Communications > Remote Desktop desktop link missing from Accessor =?Utf-8?B?R2FyeQ==?= Windows XP Help 1 27th Jan 2005 07:17 PM
Cannot follow link to open new window after Delete Cookies, Delete Files. Riaan Windows XP Internet Explorer 2 8th Apr 2004 01:49 PM
cant delete icon off desktop/cant open link in email =?Utf-8?B?c2hhdW55?= Windows XP Help 2 3rd Apr 2004 12:09 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:10 AM.