PDA

View Full Version : Creating a template and adjusting window Size and position



Forti014
11-30-2020, 02:40 AM
Hello,

I'm not really proficient with VBA, however i see the potential to optimize some of my work and wanted to ask a few questions regarding a macro i am trying to create atm. I have a code that opens multiple templates, however they all cascade on top of each other and also they are minimized. What i want to do is to have them as active windows each taking half of the left screen or just given dimensions. I found the Resize Method for outlook and also this piece of code:

Sub ActiveSize() With Application.ActiveWindow
.WindowState = olNormalWindow
.Top = 0
.Left = 972
.Width = 468
.Height = 780
End With End Sub


But i don't know how to connect it properly with the code i have managed to scramble:



Sub CreateEmailfromTemplate() Dim obApp As Application
Dim NewMail As Outlook.MailItem

Set obApp = Outlook.Application
'Change the template file folder path according to your case
Set NewMail = obApp.CreateItemFromTemplate("C:\Users\user\AppData\Roaming\Microsoft\Templates\111.oft")
NewMail.Display

Set NewMail = obApp.CreateItemFromTemplate("C:\Users\user\AppData\Roaming\Microsoft\Templates\222.oft")
NewMail.Display


Set obApp = Nothing
Set NewMail = Nothing
End Sub

Appreciate the help and feedback