Solved

Outlook Code

Posted on 2013-02-06
8
215 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

When you have clients or friends from around the world, it becomes a challenge to arrange a meeting or effectively manage your time. This is where Outlook's capability to show 2 time zones in one calendar comes in handy.
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

624 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