I have created an exe using VB6 that creates a shortcut to a database (Access). The exe is run on the completion of the Database(P&D) install. The exe shows a form saying "Do you wish to create a shortcut on the desktop?" YES NO. The exe works fine and creates a shortcut including custom Icon on the desktop. The problem I am having is the target path opens my database in access and not as a runtime. I have been unable to find a way to put the runtime path ("C:\Program Files\Common Files\Microsoft Shared\Access Runtime\Office10\MSACCESS.EXE"
followed by (/Runtime"C:\Program Files\PERT\PERT.mdb"
into the target path.
first it rejects the double path. When i place the second path into the .Arguments I get the double path but it rejects the /.
any sugestions ?
I have included my code.
It works great with .exe's and .mdb"s I have noticed alot of threads looking for a shortcut creater so I will spell it out.
Create a form with a yes and no buttons
make reference to 'Windows Script Host Object Model'Its near the end
paste the following code
-------------------------------------------------------
Private Sub Command1_Click()
' yes click
CreateMyShortcut "C:\Program Files\PERT", "PERT.lnk"
End
End Sub
________________________________________________________
Private Sub Command2_Click()
' no click
End
End Sub
---------------------------------------------------------
Create a new module and paste the following
---------------------------------------------------------
Option Explicit
Public Sub CreateMyShortcut(strTarget As String, strShortCutName As String, Optional strStartIn As String = "", Optional strArguments As String = ""
Dim wsh As Object
Dim sf As Object
Dim Shortcut As Object
Set wsh = CreateObject("wscript.shell"
Set sf = wsh.SpecialFolders
' Creates shortcut on desktop
Set Shortcut = wsh.CreateShortcut(sf("AllUsersDesktop"
& "\" & strShortCutName)
Shortcut.TargetPath = "C:\Program Files\Common Files\Microsoft Shared\Access Runtime\Office10\MSACCESS.EXE"
Shortcut.IconLocation = "C:\Program Files\PERT\pert.ico"
Shortcut.WorkingDirectory = "C:\Program Files\PERT\"
Shortcut.Description = "DEVELOPED BY iASSIST SOFTWARE DEVELOPERS"
Shortcut.Arguments = "C:\Program Files\PERT\PERT.mdb"
Shortcut.Save
' Creates shortcut in statrup
Set Shortcut = wsh.CreateShortcut(sf("AllUsersStartup"
& "\" & strShortCutName)
Shortcut.TargetPath = "C:\Program Files\PERT\PERT.mdb"
Shortcut.IconLocation = "C:\Program Files\PERT\pert.ico"
Shortcut.WorkingDirectory = "C:\Program Files\PERT\"
Shortcut.Arguments = strArguments
Shortcut.Save
End Sub
___________________________________________________________
Let me know if this helps anyone
I would like to thank all members of this forum for all your priceless information.
first it rejects the double path. When i place the second path into the .Arguments I get the double path but it rejects the /.
any sugestions ?
I have included my code.
It works great with .exe's and .mdb"s I have noticed alot of threads looking for a shortcut creater so I will spell it out.
Create a form with a yes and no buttons
make reference to 'Windows Script Host Object Model'Its near the end
paste the following code
-------------------------------------------------------
Private Sub Command1_Click()
' yes click
CreateMyShortcut "C:\Program Files\PERT", "PERT.lnk"
End
End Sub
________________________________________________________
Private Sub Command2_Click()
' no click
End
End Sub
---------------------------------------------------------
Create a new module and paste the following
---------------------------------------------------------
Option Explicit
Public Sub CreateMyShortcut(strTarget As String, strShortCutName As String, Optional strStartIn As String = "", Optional strArguments As String = ""
Dim wsh As Object
Dim sf As Object
Dim Shortcut As Object
Set wsh = CreateObject("wscript.shell"
Set sf = wsh.SpecialFolders
' Creates shortcut on desktop
Set Shortcut = wsh.CreateShortcut(sf("AllUsersDesktop"
Shortcut.TargetPath = "C:\Program Files\Common Files\Microsoft Shared\Access Runtime\Office10\MSACCESS.EXE"
Shortcut.IconLocation = "C:\Program Files\PERT\pert.ico"
Shortcut.WorkingDirectory = "C:\Program Files\PERT\"
Shortcut.Description = "DEVELOPED BY iASSIST SOFTWARE DEVELOPERS"
Shortcut.Arguments = "C:\Program Files\PERT\PERT.mdb"
Shortcut.Save
' Creates shortcut in statrup
Set Shortcut = wsh.CreateShortcut(sf("AllUsersStartup"
Shortcut.TargetPath = "C:\Program Files\PERT\PERT.mdb"
Shortcut.IconLocation = "C:\Program Files\PERT\pert.ico"
Shortcut.WorkingDirectory = "C:\Program Files\PERT\"
Shortcut.Arguments = strArguments
Shortcut.Save
End Sub
___________________________________________________________
Let me know if this helps anyone
I would like to thank all members of this forum for all your priceless information.