Results 1 to 6 of 6

Thread: Outlook version problem?

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    8

    Outlook version problem?

    Hello,

    I'm a relatively new VB programmer and am having trouble with an outlook form. Whenever I click on CommandButton2, it will only send an email with MS Outlook 2000. My colleagues are using Outlook v2002 (SP3) and clicking the button does nothing. Has anyone ever heard of this happening? Maybe one of you pros can help me out =)

    Any feedback would be greatly appreciated!

    Here's the code:




    VB Code:
    1. Sub CommandButton2_Click()
    2.     Item.cc = Item.userproperties.find("managername").value & ";" & Item.userproperties.find("employeename").value
    3.  
    4.    
    5.     If Item.userproperties.find("ScorecardChecked").value = True Then ' require checkbox marked
    6.         Item.Save  ' save current settings
    7.         Set AssignedFolder = Application.GetNameSpace("MAPI").GetDefaultFolder(6)
    8.         Set NewItem = AssignedFolder.Items.Add("IPM.Note.Staff Dialogue Routing Form")
    9.       NewItem.UserProperties.Find("Employee ID number").value = item.UserProperties.Find("Employee ID number").value
    10.       NewItem.UserProperties.Find("Manager Comments").value = item.UserProperties.Find("Manager Comments").value
    11.         NewItem.UserProperties.Find("managername").value = item.UserProperties.Find("managername").value
    12.         NewItem.UserProperties.Find("ScorecardChecked").value = item.UserProperties.Find("ScorecardChecked").value
    13.         NewItem.UserProperties.Find("Employee Comments").value = item.UserProperties.Find("Employee Comments").value
    14.         NewItem.UserProperties.Find("employeename").value = item.UserProperties.Find("employeename").value
    15.         NewItem.UserProperties.Find("lvl2Mgr").value = item.UserProperties.Find("lvl2Mgr").value
    16.         NewItem.UserProperties.Find("HRBusinessPartner").value = item.UserProperties.Find("HRBusinessPartner").value
    17.         NewItem.Body = item.body
    18.         NewItem.cc = item.cc
    19.       AlsoSendto = item.cc
    20.       ' Now, let's deal with copying the attachments from the existing form to the new form ;)
    21.       set saveAttachments = Item.Attachments
    22.         set NewAttachments = Newitem.attachments
    23.         set fso = CreateObject("Scripting.FileSystemObject")
    24.         sDirSpec = "c:\ngwm" & item.UserProperties.Find("Employee ID number").value
    25.         fso.CreateFolder (sDirSpec)
    26.  
    27.       if saveAttachments.count > 0 then                   ' The files must be saved in order to be forwarded
    28.         for i =1 to saveAttachments.count
    29.         sFileSpec = saveattachments.item(i).displayname
    30.             saveattachments.item(i).saveasfile sDirSpec  & "\" & sFileSpec
    31.           Newattachments.add sDirSpec  & "\" & sFileSpec
    32.         next       
    33.       end if
    34.         fso.DeleteFolder (sDirSpec)
    35.  
    36.         NewItem.To = AlsoSendto & "; Employee Resource Center; " & Item.UserProperties.Find("lvl2Mgr").value & ";" & mid(Item.userproperties.find("HRBusinessPartner").value,inStr(1,Item.userproperties.find("HRBusinessPartner").value," - ")+3)  
    37.      
    38.       NewItem.send
    39.  
    40.         Item.Delete ' delete current message opened
    41.     Else
    42.         MsgBox "blah"
    43.     End If
    44. End Sub
    Last edited by RobDog888; Mar 10th, 2005 at 05:01 PM. Reason: Formatted code using the vbcode tags.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Outlook version problem?

    Welcome to the Forums.

    I assume that this is Outlooks VBA code and not VB code automating Outlook.

    One thing to check is if the other users have their security setting set to medium so they can choose to run
    your code or not. If it was set to high then the code will not run.

    Another note is that in Outlook XP the .SaveAsFile is a protected method and will incur the infamous Security Popup Prompt.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    8

    Re: Outlook version problem?

    I've talked to some of my colleagues about the problem and the security settings are all at medium. Someone stated something about including a Outlook 2002 reference in the code. Do you know anything about this and how I could implement it? Thanks!

    And could it also be a problem with my Exchange Server having multiple email addresses for different people. I'm thinking the lookup could bring up some kind of error when it returns multiple emails, assuming VBA would do this. Please let me know your thoughts.

    Justin
    Last edited by panuvin; Mar 11th, 2005 at 02:07 PM.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Outlook version problem?

    Is this VB6 or Outlooks VBA Editor?

    If its the editor then there is no need to include a reference to itself. I think
    what you need to start with is some degugging.

    Try adding some logging code to write some properties/variable values to a
    text file.This way you can actually see what is happening or not happening
    and why.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    8

    Re: Outlook version problem?

    I'm using the Outlook VBA editor. I've tried taking everything out of the CommandButton2.Click() function and just adding a messagebox but nothing is happening. I keep clicking on the commandbutton2 and absolutely nothing happens, just like when all the code was there. What in the world could be going on here? Btw, The Commandbutton2 is on the "Read Page". The compose page works just fine. Thanks again for your help.

    Justin

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Outlook version problem?

    This custom form is a Published form or are you just copying it over to the other users machines?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width