Solved

VB Script in Outlook 2010 opens programs minimized

Posted on 2014-02-20
5
274 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 14

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 14

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 14

Expert Comment

by:DrTribos
ID: 39878066
Fantastic glad it helped :-)
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

This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
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…

867 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now