Change folders.

Status
Not open for further replies.

Scoth

Member
Outlook version
Email Account
Exchange Server
Hi,
I have code within a custom task form that opens a meeting request. Issue is when it's done through the task it puts the senders meeting in their task folder instead of their calendar. How to you designate the folder, currently code says currentfolder. When testing I manually changed outlook to be in calendar and it worked as it should, need to have it done through code so that these meetings will show correctly on calender, here is the current code:

Case "ENGQUALFMEA2meet"
'open fmea2 stick meeting request
Set myinspector = Item.GetInspector
Set myPage1 = myInspector.ModifiedFormPages("Step 1 Part Info")
Set ENGQUALFMEA2meet = myPage1.Controls("ENGQUALFMEA2meet")
'verify part number, new senior process revision, BU and Customer is filled in
Set EngQualNewSeniorRevTxt = myPage1.Controls("EngQualNewSeniorRevTxt")
Set EngQualPNTxt = myPage1.Controls("EngQualPNTxt")
Set EngQualBuUnit = myPage1.Controls("EngQualBuUnit")
Set EngQualCustNameTxt = myPage1.Controls("EngQualCustNameTxt")
Set EngQualFMEASentVal = myPage1.Controls("EngQualFMEASentVal")
If ENGQUALFMEA2MEET.Value = 0 Then EngQualFMEASentVal.Value = 0
If ENGQUALFMEA2MEET.Value = 0 Then Exit Sub
If EngQualBuUnit.Value < 1 Then
MsgBox "Business Unit Field on Step 1 Is Empty",,"Warning!!!"
ENGQUALFMEA2meet.Value = 0
Exit Sub
ElseIf EngQualPNTxt.Value = "" Then
MsgBox "Part Number Field on Step 1 Is Empty",,"Warning!!!"
ENGQUALFMEA2meet.Value = 0
Exit sub
ElseIf EngQualNewSeniorRevTxt.Value = "" Then
MsgBox "Senior New Process Revision Field on Step 1 Is Empty",,"Warning!!!"
ENGQUALFMEA2meet.Value = 0
Exit Sub
ElseIf EngQualCustNameTxt.Value = "" Then
MsgBox "Customer Name Field on Step 1 Is Empty",,"Warning!!!"
ENGQUALFMEA2meet.Value = 0
Exit Sub
End If
EngQualFMEASentVal.Value = 1
Fmea2Subject = "P/N_Sr. New Process Rev.:(" & EngQualPNTxt.Value & ")_((" & EngQualNewSeniorRevTxt.Value & "))_Business Unit{" & EngQualBuUnit.Value & "}_Customer: {{" & EngQualCustNameTxt.Value & "}}"
FMEA2Body = "Part Number: " & EngQualPNTxt.Value & Chr(13) & "Senior Process Revision: " & EngQualNewSeniorRevTxt.Value & Chr(13) & "Business Unit (If 3, Part will utilize both Business Units): " & EngQualBuUnit.Value & Chr(13) & "Customer: " & EngQualCustNameTxt.Value
Msgbox "Do Not Modify Meeting Request Subject Information",,"Caution!!!"
strform = "IPM.APPOINTMENT.FMEAStickLvl2"
Set objfolder = Application.ActiveExplorer.currentFolder
Set objItem = objFolder.Items.Add(strform)
objitem.Subject = FMEA2Subject 'added
objitem.Location = "Training Room"
'objitem.Start = Now() + 5
objitem.body = FMEA2Body

Thanks for any help you can offer.
 
Here is your problem:
strform = "IPM.APPOINTMENT.FMEAStickLvl2"
Set objfolder = Application.ActiveExplorer.currentFolder
Set objItem = objFolder.Items.Add(strform)

you are using current folder. You need to use calendar - try this:
Set objfolder = Application.GetDefaultFolder(olFolderCalendar)
or

Set objfolder = Session.GetDefaultFolder(olFolderCalendar)
 
Diane,
When trying the first suggestion it comes up with not supported, the second suggestion it come up as invalid??

Sent from my iPad using Tapatalk HD
 
Both work in Outlook 2013/2010 - I'll have to check it in 2003 to verify, but I'm pretty sure it should work.
 
Diane,
Form was originally created in 2003, now running 2010

Sent from my iPad using Tapatalk HD
 
if you are using 2010, it should work.
 
ok... if Set objfolder = Application.GetDefaultFolder(olFolderCalendar) doesn't work, try using
At the top put these lines:
Dim Ns As Outlook.NameSpace
Set Ns = Application.GetNamespace("MAPI")

then use this in place of the activeexplorer.currentfolder line.

Set objfolder = NS.GetDefaultFolder(olFolderCalendar)
 
Diane,
Thanks so much, your suggestion worked, I also tried the following and it worked as well
Set myNameSpace = Application.GetNameSpace("MAPI")
Set Application.ActiveExplorer.CurrentFolder = _
myNameSpace.GetDefaultFolder(9)

Thanks again

Sent from my iPad using Tapatalk HD
 
Yes, using that to switch the current folder to the calendar works too.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
M cannot change delivery folders with IMAP accounts Using Outlook 0
H Change flags across multiple folders? Using Outlook 5
Diane Poremsky Change Item Count on All Folders in a Data File Using Outlook 0
Phillip Macro to Change View on All Folders Using Outlook 4
T Unexpected change of the order of the folders in my navigation pane Using Outlook 6
J Change the subject line of messages in public folders Using Outlook 3
J Public folders woes (script to change subject line of messages) Exchange Server Administration 0
M Use Macro to change account settings Outlook VBA and Custom Forms 0
D Unable to change AppointmentItem.Start property Outlook VBA and Custom Forms 3
sjmo2 Change subject for new e-mails only. Outlook VBA and Custom Forms 2
Horsepower Contact phone numbers randomly change Using Outlook 0
P Outlook 2016 Change Paste Special Default Format Using Outlook 8
whizzard Change FROM address based on TO or CC address Outlook VBA and Custom Forms 8
S Outlook 365 Can I change the possible range of highlighting colours when writing an Outlook email? Using Outlook 1
V Can one change the formatting of email title blocks? Using Outlook 0
S Unable to change Message Class Outlook VBA and Custom Forms 0
S New Outlook Appointment - Select All Body Text and Change Font and Size Outlook VBA and Custom Forms 1
J VBA Cannot programmatically input or change Value for User Defined field Using Outlook 1
C Outlook 365 Can you change the follow up colour? Using Outlook 1
A Change settings Send/receive VBA Outlook VBA and Custom Forms 0
E Outlook VBA change GetDefaultFolder dynamically Outlook VBA and Custom Forms 6
O What would be the recommended way to change an email address (family member)? Using Outlook 0
S Change "This Week" flag start date behavior Using Outlook 1
N Help creating a VBA macro with conditional formatting to change the font color of all external emails to red Outlook VBA and Custom Forms 5
D Change Microsoft Account password - what to do to update on all devices Using Outlook 4
S Outlook 2016 Change how Outlook shows me contacts in emails Using Outlook 0
Witzker HowTo Change message Class of contact form Outlook VBA and Custom Forms 0
Z Outlook 365 delete reminder you can’t make change to contents of this-read only folder Using Outlook 4
Witzker Pls help to change the code for inserting date in Ol contact body Outlook VBA and Custom Forms 5
R How to Change Margins In Google Docs...? Using Outlook 0
e_a_g_l_e_p_i Outlook 2010 How can I change the font size on right side appointment pane Using Outlook 12
diver864 vba for a rule to automatically accept meeting requests with 'vacation' in subject, change to all-day event, change to free, don't send reply Outlook VBA and Custom Forms 1
B Change Font and Font size using VBA Outlook VBA and Custom Forms 9
D Change senders title Using Outlook 1
W Recurrence: delete older occurrences / change earliest start time Outlook VBA and Custom Forms 0
E Change sending account depending on Subjectline Outlook VBA and Custom Forms 0
J Outlook 2013 Change color of text in data fields of contacts in Outlook 2013? Using Outlook 10
B Change row background color of selected item Using Outlook 1
PGSystemTester VBA To Change AppointmentItem.BusyStatus From MeetingItem Before Send Using Outlook 0
B Change from Address Outlook VBA and Custom Forms 0
X If you change expiration date of repeated task it dupplicates Using Outlook 1
E How to display "Change Folder" in Change Default Email Delivery Location in Exchange Outlook 2016 Using Outlook 1
Z See "Change View" Drop Down as a List? Using Outlook 1
V Change start time based on message duration Outlook VBA and Custom Forms 2
R Folder pane width change Using Outlook 90
S Change VBA script to send HTML email instead of text Outlook VBA and Custom Forms 3
S Outlook 2010 unable to change default font Using Outlook 7
P How can I change my calendar view back Using Outlook 3
A Edit subject - and change conversationTopic - using VBA and redemption Outlook VBA and Custom Forms 2
T Change the selected Message in the Outlook window Outlook VBA and Custom Forms 2

Similar threads

Back
Top