Solved

Outlook Code

Posted on 2013-02-06
8
206 Views
Last Modified: 2013-05-09
Hello,

I have a custom form within Outlook 2010 that opens a folder on the network.  It works fine on Windows XP.  But on Windows 7, it opens the folder, but also opens a blank instance of Internet Explorer.  How can I stop the IE from opening?

Function CommandButtonGoToFolder

Dim objWeb

On Error Resume Next

JobYear = cstr(Year(Item.UserProperties("JobInitiatedDate")))

Set objWeb = CreateObject("InternetExplorer.Application")
objWeb.Navigate "\\TGPS13VM1\drawing$\Jobs-"+JobYear+"\"+Item.UserProperties("JobNumber")+" "+Item.UserProperties("JobName")
objWeb.Visible = True

End Function

Open in new window

0
Comment
Question by:Genius123
  • 4
  • 3
8 Comments
 
LVL 4

Expert Comment

by:ChanduNelluri
Comment Utility
Hello Genius123

Which version of browser are you using in Win XP? From IE7 onwards, integration between Windows Explorer and IE is removed so it doesn't allow folder browsing etc inside IE. It simply redirects to Windows Explorer.

You may need to update the code to support latest browser. Although I don't expect any major code changes.

-Chandu
0
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
Hi, Genius123.

Why are you using Internet Explorer to open a network folder?  Why not just open the folder in Windows Explorer?
0
 

Author Comment

by:Genius123
Comment Utility
BlueDevilFan,

I would like to open it directly in Windows Explorer, but I'm don't know the code.  Can you help me with that?

Joel
0
 
LVL 76

Accepted Solution

by:
David Lee earned 250 total points
Comment Utility
Hi, Joel.

Add this code to what you already have.

Sub RunExternalProgram(strCommand As String, bolWaitForReturn As Boolean)
    Dim objShell As Object
    Set objShell = CreateObject("WScript.Shell")
    objShell.Run strCommand, , bolWaitForReturn
    Set objShell = Nothing
End Sub

Open in new window


Call the subroutine like this

RunExternalProgram "Explorer.exe " & "\\TGPS13VM1\drawing$\Jobs-"+JobYear+"\"+Item.UserProperties("JobNumber")+" "+Item.UserProperties("JobName"), False

Open in new window


Assuming that the path is correct and the folder exists, the folder should open in Windows Explorer.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:Genius123
Comment Utility
I get the error:

Expected ')'

on this line:

Sub RunExternalProgram(strCommand As String, bolWaitForReturn As Boolean)
0
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
I don't know how that's possible.  The parenthesis are balanced and when I tested it I didn't get any errors.  Are you sure it copied over correctly?
0
 

Author Comment

by:Genius123
Comment Utility
I checked and it's copied correctly.  Code in the Outlook environment is a little different I think that normal VB or VB Script.  I think it doesn't like the:

(strCommand As String, bolWaitForReturn As Boolean)

Maybe I have to declare it as a global variable or a constant?
0
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
Sorry, I just noticed that you're using this in a form.  Apologies, I missed that somehow.  Change the code to this

Sub RunExternalProgram(strCommand, bolWaitForReturn)
    Dim objShell
    Set objShell = CreateObject("WScript.Shell")
    objShell.Run strCommand, , bolWaitForReturn
    Set objShell = Nothing
End Sub                                   

Open in new window

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Granting full access permission allows users to access mailboxes present in their database. By giving full access permission one can open and read the content of any mailbox but cannot send emails from that mailbox.
Check out this infographic on what you need to make a good email signature that will work perfectly for your organization.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now