473,378 Members | 1,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,378 developers and data experts.

Create a shortcut for your application automatically

TheSmileyCoder
2,322 Expert Mod 2GB
In my install application found at:
Access Application Installer with Shortcut Creation


I use this code to generate shortcuts for the user. In my installer application I have it setup to create a shortcut both on the users desktop, as well as in the users Programs Folder (the one you get to by Clicking Start->Programs)


Expand|Select|Wrap|Line Numbers
  1. Public Sub Create_ShortCut(ByVal TargetPath As String, ByVal ShortCutPath As String, ByVal ShortCutname As String, Optional ByVal WorkPath As String, Optional ByVal Window_Style As Integer, Optional ByVal ShortcutLetter As String)
  2.    'Create a Windows Script Host Object
  3.       Dim objWSHShell As Object
  4.       Set objWSHShell = CreateObject("WScript.Shell")
  5.  
  6.    'Create shortcut
  7.       Dim MyShortcut As Object
  8.       ShortCutPath = objWSHShell.SpecialFolders(ShortCutPath & "")
  9.       Set MyShortcut = objWSHShell.CreateShortcut(ShortCutPath & "\" & ShortCutname & ".lnk")
  10.       MyShortcut.TargetPath = TargetPath
  11.       MyShortcut.WorkingDirectory = WorkPath
  12.       MyShortcut.WindowStyle = Window_Style
  13.       If strIconFullPath <> "" Then
  14.          MyShortcut.IconLocation = strIconFullPath
  15.       End If
  16.       If ShortcutLetter <> "" And Len(ShortcutLetter) = 1 Then
  17.          MyShortcut.hotkey = "Ctrl+ALT+" & ShortcutLetter
  18.       End If
  19.       MyShortcut.Save
  20.  
  21.    'cleanup
  22.       Set MyShortcut = Nothing
  23.       Set objWSHShell = Nothing
  24.  
  25. End Sub
Mar 2 '12 #1
1 6361
There is a BUG in Wscript (TargetPath).

Try the command line for ms Access shortcut like:
Expand|Select|Wrap|Line Numbers
  1. "path access.exe" "path to accessdb" /params "path to mdw" /params2
If you use wscript all backward slashes becomes forward slashes for the params part.

Did not find a workaround yet.
Also
Expand|Select|Wrap|Line Numbers
  1. char(47)
does NOT do the trick.
Aug 11 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Ian Quennell | last post by:
I have just installed VS.net on Windows 2000. I am trying to create a web application but I get the error "Error when attempting to create or open the web project located at the following URL: ...
0
by: New Guy | last post by:
Hello, I want to create an application that can be hooked up to a TV display to do home theatre type functions. Things like play mp3 music, view photos, play avi's, display weather reports and...
6
by: Tomas Machala | last post by:
Hi, how can I create non-visual application in Visual Studio 2003? Theoretically I could just make windows form invisible but it's not much elegant. I've also tried to use console application but...
12
by: David Berman | last post by:
Whenever I want to create a C# / asp.net based web site, Visual Studio always requires a subdirectory for the project. So when I make my site, for example abcinc.com, the web site ends up at...
4
by: I_AM_DON_AND_YOU? | last post by:
There is one more problem I am facing but didn't get the solution. In my Setup Program I am not been able to create 2 things (when the program is intalled on the client machine ) : (1) create...
3
by: cherishman | last post by:
I want to create a DLL application with VB.NET, which can be used by PowerBuilder. How can I do it?
9
by: tigger | last post by:
Hi, I'm using Visual Basic 2005. I'm trying to create shortcut keys for my buttons. Currently, i have 2 buttons, presentButton and plotButton. When i press spacebar, it will perform the...
1
by: bipi | last post by:
Hi everybody, I deploy my project by using .NET deployment. I create shortcut at Desktop, but this shortcut does not have "Run as..." option. How can I create shortcut with "Run as..." option...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.