Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Outlook Code

Posted on 2013-02-06
8
Medium Priority
?
216 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 76

Accepted Solution

by:
David Lee earned 1000 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

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.
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 …
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…
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…

715 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