Solved

Outlook Code

Posted on 2013-02-06
8
214 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 4

Expert Comment

by:ChanduNelluri
ID: 38862298
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
ID: 38862380
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
ID: 38864357
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 76

Accepted Solution

by:
David Lee earned 250 total points
ID: 38864431
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
 

Author Comment

by:Genius123
ID: 38864554
I get the error:

Expected ')'

on this line:

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

Expert Comment

by:David Lee
ID: 38864751
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
ID: 38864842
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
ID: 38865118
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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
If you troubleshoot Outlook for clients, you may want to know a bit more about the OST file before doing your next job. IMAP can cause a lot of drama if removed in the accounts without backing up.
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…

734 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