Solved

Outlook Code

Posted on 2013-02-06
8
213 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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

Independent Software Vendors: 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!

Question has a verified solution.

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

What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
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 …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

739 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