Link to home
Start Free TrialLog in
Avatar of Genius123
Genius123Flag for United States of America

asked on

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
Avatar of DrTribos
DrTribos
Flag of Australia image

Something like this might help...
application.Windows(1).WindowState = wdWindowStateMaximize

Open in new window

Avatar of Genius123

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of DrTribos
DrTribos
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That worked!  Thanks!
Fantastic glad it helped :-)