Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Creating Database Shortcut To Desktop Using VBA


Message #1 by "Derrick A. Flores" <derrick_flores@s...> on Wed, 21 Nov 2001 17:54:34
Hello everyone,

I developed and managed about 17 database (and still growing).  To make 

sure that everybody has a shortcut on their computer, I'm making a 

database that will allow users to select the different types of database 

that they will need.  I have a form with check boxes for the different 

databases.  I would like for the users to check off the database that 

he/she needs and click on a button that will create a shortcut on his/her 

desktop.  I will also track his/hers user name, computer name,and date 

when a shortcut was created (So I can track my users).  I tried coping the 

actual shortcut that I'd made using FileCopy but it copied the entire 

database to the location instead of the shortcut (*.ink) file that I'd 

created.



thanks,

Derrick Flores
Message #2 by "Pardee, Roy E" <roy.e.pardee@l...> on Wed, 21 Nov 2001 10:05:43 -0800
[I like that idea!]



There are api calls you can make that will cause shortcuts to be created,

but probably the easiest way is to use the windows script host object model.

That lib provides you with a Shortcut object you can create and save, and

also an easy way to retrieve the file system path of the folder

corresponding to the current user's desktop, or start menu, etc.



See http://members.home.net/r.pardee/WSHStuff.htm for details on the

reference to set.  Here's a code snippet for creating a shortcut:



' -------------------------------

   ' Find the path to the user's desktop

   strShortCutPath = WshShell.SpecialFolders("Desktop") & "\" &

strcShortCutName



   Set ShortCut = WshShell.CreateShortcut(strShortCutPath)



   strShortCutTarget = "C:\ent\appl\prod\office\Office\MSACCESS.EXE"



   ShortCut.TargetPath = strShortCutTarget



   ' Set command line arguments in the .Arguments property

   ShortCut.Arguments =  " /excl " & strcLocalPath & "\" & strcMDEName



   ShortCut.Save

' -------------------------------



The one real gotcha here is to use the .TargetPath *only* for the call to

MSAccess.exe--if you try to tack your arguments onto the end of that, the

Shortcut object tries to "help" you by changing forward slashes to back

slashes & otherwise screws up the shortcut.



HTH,



-Roy



Roy Pardee

Programmer/Analyst

SWFPAC Lockheed Martin IT

Extension 8487



-----Original Message-----

From: Derrick A. Flores [mailto:derrick_flores@s...]

Sent: Wednesday, November 21, 2001 9:55 AM

To: Access

Subject: [access] Creating Database Shortcut To Desktop Using VBA





Hello everyone,

I developed and managed about 17 database (and still growing).  To make 

sure that everybody has a shortcut on their computer, I'm making a 

database that will allow users to select the different types of database 

that they will need.  I have a form with check boxes for the different 

databases.  I would like for the users to check off the database that 

he/she needs and click on a button that will create a shortcut on his/her 

desktop.  I will also track his/hers user name, computer name,and date 

when a shortcut was created (So I can track my users).  I tried coping the 

actual shortcut that I'd made using FileCopy but it copied the entire 

database to the location instead of the shortcut (*.ink) file that I'd 

created.



thanks,

Derrick Flores




Message #3 by "Rogers, Robert" <rrogers@b...> on Wed, 21 Nov 2001 13:25:07 -0500
Hey sorry I can't help but that's a great idea.  I would like a write up on

that specific database design.



Robert L. Rogers

Rexel Branch Electric

Application Developer

xxx-xxx-xxxx





-----Original Message-----

From: Derrick A. Flores [mailto:derrick_flores@s...]

Sent: Wednesday, November 21, 2001 12:55 PM

To: Access

Subject: [access] Creating Database Shortcut To Desktop Using VBA





Hello everyone,

I developed and managed about 17 database (and still growing).  To make 

sure that everybody has a shortcut on their computer, I'm making a 

database that will allow users to select the different types of database 

that they will need.  I have a form with check boxes for the different 

databases.  I would like for the users to check off the database that 

he/she needs and click on a button that will create a shortcut on his/her 

desktop.  I will also track his/hers user name, computer name,and date 

when a shortcut was created (So I can track my users).  I tried coping the 

actual shortcut that I'd made using FileCopy but it copied the entire 

database to the location instead of the shortcut (*.ink) file that I'd 

created.



thanks,

Derrick Flores










****************************************************************************

******************************************************

This e-mail and any files transmitted with it are confidential and intended

solely for the use of the individual or entity to whom they are addressed.

If you have received this e-mail in error please notify the sender and

delete/destroy any copies.

****************************************************************************

******************************************************

Message #4 by John Fejsa <John.Fejsa@h...> on Thu, 22 Nov 2001 08:28:17 +1100
One way of doing it:



Paste this code into you module.



Option Compare Database

Option Explicit



Declare Function fCreateShellLink Lib "STKIT432.DLL" _

(ByVal lpstrFolderName As String, ByVal lpstrLinkName _

As String, ByVal lpstrLinkPath As String, ByVal _

lpstrLinkArgs As String) As Long





Paste and manipulate thisa code into your CreateShortcut_Click button 

event or whatever you called the button...

Or you can paste it into your modules and call it as required passing the 

required shortcut and database names to the function.



Dim lngResult As Long



lngResult =3D fCreateShellLink("..\..\Desktop", _

"Testing This Link", "D:\Projects\Common\common.mdb", "")



That's all there is?



PS; you may need to download STKIT432.DLL file from Microsoft or other 

sources.





____________________________________________________



John Fejsa

Systems Analyst/Computer Programmer

Hunter Centre for Health Advancement

Locked Bag 10

WALLSEND NSW 2287

Phone: (02) 49246 336 Fax: (02) 49246 209

____________________________________________________



The doors we open and close each day decide the lives we live

____________________________________________________



CONFIDENTIALITY & PRIVILEGE NOTICE

The information contained in this email message is intended for the named 

addressee only.  If you are not the intended recipient you must not copy, 

distribute, take any action reliant on, or disclose any details of the 

information in this email to any other person or organisation.  If you 

have received this email in error please notify us immediately.



>>> derrick_flores@s... 22/11/2001 4:54:34 >>>

Hello everyone,

I developed and managed about 17 database (and still growing).  To make

sure that everybody has a shortcut on their computer, I'm making a

database that will allow users to select the different types of database=20



that they will need.  I have a form with check boxes for the different

databases.  I would like for the users to check off the database that

he/she needs and click on a button that will create a shortcut on 

his/her

desktop.  I will also track his/hers user name, computer name,and date

when a shortcut was created (So I can track my users).  I tried coping 

the

actual shortcut that I'd made using FileCopy but it copied the entire

database to the location instead of the shortcut (*.ink) file that I'd

created.



thanks,

Derrick Flores



.au






This message is intended for the addressee named and may contain confidential information. If you are not the intended recipient,
please delete it and notify the sender. Views expressed in this message are those of the individual sender, and are not necessarily
the views of Hunter Health.




  Return to Index