Solved

VB Script in Outlook 2010 opens programs minimized

Posted on 2014-02-20
5
276 Views
Last Modified: 2014-02-21
Hello,

I have script that opens Word and other programs.  They always open in a minimized state.  I've set Word to always open maximized but it doesn't work.

Any ideas?  Here's my code.
Joel

Private Function GetWordDocLabelHold(strTemplatePath)
    On Error Resume Next
    m_blnWeOpenedWord = False
    Set objWord2 = GetObject(, "Word.Application")
    If objWord2 Is Nothing Then
        Set objWord2 = CreateObject("Word.Application")
        m_blnWeOpenedWord = True
   End If
    m_blnWordPrintBackground = _
      objWord2.Options.PrintBackground
    If strTemplatePath = "" Then
        strTemplatePath = "\\TGPS13VM1\drawing$\Jobs\Task_Templates\Normal.dot"
   End If
   objWord2.Visible = True
    Set GetWordDocLabelHold = objWord2.Documents.Add(strTemplatePath)

End Function
0
Comment
Question by:Genius123
  • 3
  • 2
5 Comments
 
LVL 15

Expert Comment

by:DrTribos
ID: 39875535
Something like this might help...
application.Windows(1).WindowState = wdWindowStateMaximize

Open in new window

0
 

Author Comment

by:Genius123
ID: 39877600
Thanks.  It's not quite working.  Do I need to define it as a constant?  Here's another one I use.  If so, do you know what the value would be?

Const wdDoNotSaveChanges = 0
0
 
LVL 15

Accepted Solution

by:
DrTribos earned 500 total points
ID: 39878014
Well I can confirm the constant is 1
(wdWindowStateMaximize = 1)

Hope that helps

From where is your script running?
0
 

Author Closing Comment

by:Genius123
ID: 39878026
That worked!  Thanks!
0
 
LVL 15

Expert Comment

by:DrTribos
ID: 39878066
Fantastic glad it helped :-)
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

828 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