• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

VB Script in Outlook 2010 opens programs minimized

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
Genius123
Asked:
Genius123
  • 3
  • 2
1 Solution
 
DrTribosCommented:
Something like this might help...
application.Windows(1).WindowState = wdWindowStateMaximize

Open in new window

0
 
Genius123Author Commented:
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
 
DrTribosCommented:
Well I can confirm the constant is 1
(wdWindowStateMaximize = 1)

Hope that helps

From where is your script running?
0
 
Genius123Author Commented:
That worked!  Thanks!
0
 
DrTribosCommented:
Fantastic glad it helped :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now