A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Macro that creates desktop shortcut



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 22nd 06, 05:47 PM posted to microsoft.public.outlook.program_vba
A1pro
external usenet poster
 
Posts: 5
Default Macro that creates desktop shortcut

Hello,

I'm trying to write a macro that creates a shortcut on desktop for internet
explorer so that it opens a particular website, let's say my isp 62.30.31.74

two questions:

1st is it possible to do this?
2nd is it possible to embed it on a email so that several people have the
shortcuts created

TIA



Ads
  #2  
Old November 22nd 06, 05:53 PM posted to microsoft.public.outlook.program_vba
A1pro
external usenet poster
 
Posts: 5
Default Macro that creates desktop shortcut

I found this
Sub shortcut()

On Error Resume Next
'Dim wsShell As New WshShell
'Dim wsSCut As WshShortcut
Dim strCommandLine As String 'Command Line for shortcut to run
strCommandLine = Chr(34) & "C:\Program Files\Internet
Explorer\IEXPLORE.EXE" & "62.30.31.74" & Chr(34) '62.30.31.74
'strCommandLine = strCommandLine & " /WrkGrp " & Chr(34) &
"C:\Security.mdw" & Chr(34)
'strCommandLine = strCommandLine & " " & Chr(34) & "C:\MyDb.mdb" & Chr(34)
Set wsSCut = wsShell.CreateShortcut("D:\Documents and
Settings\jzywr0\Desktop\ShortcutTomyexplorer.lnk")
With wsSCut
.TargetPath = strCommandLine
.Save
End With

Set wsSCut = Nothing
Set wsShell = Nothing
End Sub

but does not work
if I uncomment wsshell it complains

I guess I need to add a reference though no idea which reference

any ideas?

if i uncomment

"A1pro" wrote:

Hello,

I'm trying to write a macro that creates a shortcut on desktop for internet
explorer so that it opens a particular website, let's say my isp 62.30.31.74

two questions:

1st is it possible to do this?
2nd is it possible to embed it on a email so that several people have the
shortcuts created

TIA



  #3  
Old November 23rd 06, 07:56 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Macro that creates desktop shortcut


You can call the object without a ref:
Dim WSH As Object

Set WSH = CreateObject("WScript.Shell")

For a ref select 'Windows Script Host Object Model'. In the Object Browser
it's then called 'IWshRuntimeLibrary'.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --


Am Wed, 22 Nov 2006 08:53:02 -0800 schrieb A1pro:

I found this
Sub shortcut()

On Error Resume Next
'Dim wsShell As New WshShell
'Dim wsSCut As WshShortcut
Dim strCommandLine As String 'Command Line for shortcut to run
strCommandLine = Chr(34) & "C:\Program Files\Internet
Explorer\IEXPLORE.EXE" & "62.30.31.74" & Chr(34) '62.30.31.74
'strCommandLine = strCommandLine & " /WrkGrp " & Chr(34) &
"C:\Security.mdw" & Chr(34)
'strCommandLine = strCommandLine & " " & Chr(34) & "C:\MyDb.mdb" &

Chr(34)
Set wsSCut = wsShell.CreateShortcut("D:\Documents and
Settings\jzywr0\Desktop\ShortcutTomyexplorer.lnk")
With wsSCut
.TargetPath = strCommandLine
.Save
End With

Set wsSCut = Nothing
Set wsShell = Nothing
End Sub

but does not work
if I uncomment wsshell it complains

I guess I need to add a reference though no idea which reference

any ideas?

if i uncomment

"A1pro" wrote:

Hello,

I'm trying to write a macro that creates a shortcut on desktop for

internet
explorer so that it opens a particular website, let's say my isp

62.30.31.74

two questions:

1st is it possible to do this?
2nd is it possible to embed it on a email so that several people have

the
shortcuts created

TIA



  #4  
Old November 23rd 06, 10:50 AM posted to microsoft.public.outlook.program_vba
A1pro
external usenet poster
 
Posts: 5
Default Macro that creates desktop shortcut

Thanks that works great

One thing i'm struggling with now is that, .targetpath seems to add quotes
(") at the beginning and end of whatever you set .targetpath to be.

Is there anyway around this. Because that way you cannot set a shortcut to a
webpage.

command needed to link to a webpage: "C:\Program Files\Internet
Explorer\IEXPLORE.EXE" 62.30.31.74

if I set .targetpath to be : "C:\Program Files\Internet
Explorer\IEXPLORE.EXE" 62.30.31.74

The result is "C:\Program Files\Internet Explorer\IEXPLORE.EXE 62.30.31.74"
which does not work.

Any ideas?

Also is there an easy way to embed this macro on an email.

So when the recipient opens the email, it will run the macro automatically

TIA

"Michael Bauer [MVP - Outlook]" wrote:


You can call the object without a ref:
Dim WSH As Object

Set WSH = CreateObject("WScript.Shell")

For a ref select 'Windows Script Host Object Model'. In the Object Browser
it's then called 'IWshRuntimeLibrary'.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --


Am Wed, 22 Nov 2006 08:53:02 -0800 schrieb A1pro:

I found this
Sub shortcut()

On Error Resume Next
'Dim wsShell As New WshShell
'Dim wsSCut As WshShortcut
Dim strCommandLine As String 'Command Line for shortcut to run
strCommandLine = Chr(34) & "C:\Program Files\Internet
Explorer\IEXPLORE.EXE" & "62.30.31.74" & Chr(34) '62.30.31.74
'strCommandLine = strCommandLine & " /WrkGrp " & Chr(34) &
"C:\Security.mdw" & Chr(34)
'strCommandLine = strCommandLine & " " & Chr(34) & "C:\MyDb.mdb" &

Chr(34)
Set wsSCut = wsShell.CreateShortcut("D:\Documents and
Settings\jzywr0\Desktop\ShortcutTomyexplorer.lnk")
With wsSCut
.TargetPath = strCommandLine
.Save
End With

Set wsSCut = Nothing
Set wsShell = Nothing
End Sub

but does not work
if I uncomment wsshell it complains

I guess I need to add a reference though no idea which reference

any ideas?

if i uncomment

"A1pro" wrote:

Hello,

I'm trying to write a macro that creates a shortcut on desktop for

internet
explorer so that it opens a particular website, let's say my isp

62.30.31.74

two questions:

1st is it possible to do this?
2nd is it possible to embed it on a email so that several people have

the
shortcuts created

TIA




  #5  
Old November 23rd 06, 11:38 AM posted to microsoft.public.outlook.program_vba
A1pro
external usenet poster
 
Posts: 5
Default Macro that creates desktop shortcut

Ok, So I found out that if you just set targetpath to http://ipaddress it works

Now I need to create it on desktop. This has to go to several people, and I
do not know their desktop filepaths

I found this command
DesktopPath = WSHShell.SpecialFolders("Desktop"), it works fine for
scripting but I can't make it work on vba

any ideas?

TIA

"A1pro" wrote:

Thanks that works great

One thing i'm struggling with now is that, .targetpath seems to add quotes
(") at the beginning and end of whatever you set .targetpath to be.

Is there anyway around this. Because that way you cannot set a shortcut to a
webpage.

command needed to link to a webpage: "C:\Program Files\Internet
Explorer\IEXPLORE.EXE" 62.30.31.74

if I set .targetpath to be : "C:\Program Files\Internet
Explorer\IEXPLORE.EXE" 62.30.31.74

The result is "C:\Program Files\Internet Explorer\IEXPLORE.EXE 62.30.31.74"
which does not work.

Any ideas?

Also is there an easy way to embed this macro on an email.

So when the recipient opens the email, it will run the macro automatically

TIA

"Michael Bauer [MVP - Outlook]" wrote:


You can call the object without a ref:
Dim WSH As Object

Set WSH = CreateObject("WScript.Shell")

For a ref select 'Windows Script Host Object Model'. In the Object Browser
it's then called 'IWshRuntimeLibrary'.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --


Am Wed, 22 Nov 2006 08:53:02 -0800 schrieb A1pro:

I found this
Sub shortcut()

On Error Resume Next
'Dim wsShell As New WshShell
'Dim wsSCut As WshShortcut
Dim strCommandLine As String 'Command Line for shortcut to run
strCommandLine = Chr(34) & "C:\Program Files\Internet
Explorer\IEXPLORE.EXE" & "62.30.31.74" & Chr(34) '62.30.31.74
'strCommandLine = strCommandLine & " /WrkGrp " & Chr(34) &
"C:\Security.mdw" & Chr(34)
'strCommandLine = strCommandLine & " " & Chr(34) & "C:\MyDb.mdb" &

Chr(34)
Set wsSCut = wsShell.CreateShortcut("D:\Documents and
Settings\jzywr0\Desktop\ShortcutTomyexplorer.lnk")
With wsSCut
.TargetPath = strCommandLine
.Save
End With

Set wsSCut = Nothing
Set wsShell = Nothing
End Sub

but does not work
if I uncomment wsshell it complains

I guess I need to add a reference though no idea which reference

any ideas?

if i uncomment

"A1pro" wrote:

Hello,

I'm trying to write a macro that creates a shortcut on desktop for

internet
explorer so that it opens a particular website, let's say my isp

62.30.31.74

two questions:

1st is it possible to do this?
2nd is it possible to embed it on a email so that several people have

the
shortcuts created

TIA




  #6  
Old November 23rd 06, 11:57 AM posted to microsoft.public.outlook.program_vba
A1pro
external usenet poster
 
Posts: 5
Default Macro that creates desktop shortcut

This seems to do the programatic trick:
Sub CreateShortcut()

On Error Resume Next

Dim wsShell As Object
Dim wsSCut As Object

Set wsShell = CreateObject("WScript.Shell")

DesktopPath = wsShell.SpecialFolders("Desktop") 'Finds Desktop folder

shortcutPath = DesktopPath & "\" & "telewest.lnk" ' adds shortcut name

Set wsSCut = wsShell.CreateShortcut(shortcutPath) ' creates shortcut


With wsSCut
.TargetPath = "http://62.30.31.74" ' this selects iexplorer and sets
the ip address
.Save
End With

Set wsSCut = Nothing
Set wsShell = Nothing
End Sub

Now I'm trying to think how to distribute it.

Any way to embed this on an email?
or do security issues get on the way?

any help would be appreciated

TIA

  #7  
Old November 24th 06, 07:27 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Macro that creates desktop shortcut



Hopefully there's no way to get it executed automatically. Maybe you can
create a *.vbs file, attach that to the e-mail and ask the user to save the
attachment as a file and run it.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --

Am Thu, 23 Nov 2006 02:57:01 -0800 schrieb A1pro:

This seems to do the programatic trick:
Sub CreateShortcut()

On Error Resume Next

Dim wsShell As Object
Dim wsSCut As Object

Set wsShell = CreateObject("WScript.Shell")

DesktopPath = wsShell.SpecialFolders("Desktop") 'Finds Desktop folder

shortcutPath = DesktopPath & "\" & "telewest.lnk" ' adds shortcut name

Set wsSCut = wsShell.CreateShortcut(shortcutPath) ' creates shortcut


With wsSCut
.TargetPath = "http://62.30.31.74" ' this selects iexplorer and

sets
the ip address
.Save
End With

Set wsSCut = Nothing
Set wsShell = Nothing
End Sub

Now I'm trying to think how to distribute it.

Any way to embed this on an email?
or do security issues get on the way?

any help would be appreciated

TIA

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New Mail Desktop Shortcut Rob D. Outlook - General Queries 9 August 21st 06 09:42 PM
desktop shortcut for Outlook Calendar MartinY Outlook - Calandaring 1 May 12th 06 02:23 AM
Desktop shortcut for the Address Book? Fuzzy Logic Outlook - General Queries 8 March 30th 06 12:46 AM
Desktop Shortcut for viewing contacts VFQuestion Outlook - Using Contacts 0 January 27th 06 05:52 PM
desktop shortcut for Outlook Calendar Luc Outlook - Calandaring 0 January 19th 06 09:49 PM


All times are GMT +1. The time now is 08:28 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.