How To Port VBA Macro Into A VB6 Addin For Outlook
Hi. With lots of help from Cimperiali I have determined that the only way I can do the projects I was assigned is to port my Outlook VBA macro to the VB6 Addin so that I can add this addin to the Outlook thus it will be "installable" on other PCs without much hastle.
The problem, of course is that I have no experience in programming addins and of course even after I have found that I have to use interface IDTExtensibility2 with its 5 base required functions I still doubt how to make everyting work.
In the macro I have a function in the module with the same name as a macro where everything starts (i call my userforms). Plus in the module I declare all the public variables. Then where would all this go?
Then userforms can be imported into the VB project as well as module, but where do I instantiate them and all that??
If you know any related and helpful info I would be very grateful to hear it. Thank you in advance people.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
VB6 Addin For Outlook - The Operation Failed On Outlook Startup
Hi,
I am having a strange occurrance of "The operation failed" when I shut down Outlook and reopen it too quickly. Possibly after 5 - 10 seconds I can reopen Outlook safely. It seems as though outlook is taking its time to unload successfully as well as the VB6 written addin. Would there be any way to detect this so that either on .OnConnection or .OnDisconnection? VB.NET has a garbage collector, is there something similar to this that could be written for VB6?
I would appreciate anyone's assistance with this message.
Macro From A AddIn
Hi Forum
I created a AddIn with the name addin1 and this Sub in it:
Sub add1()
do something...
End
And i creat a Excelworkbook called book.xls with this macro:
Sub Auto_Open()
call add1
End
but it doesn't work. The call can find the add1 function.
I thougt, that this is possible. I'm wrong?
macloy
Run An Excel Addin Macro From Vb App
I recorded the following excel macro:
VB Code:
Application.Run "ATPVBAEN.XLA!Histogram", ActiveSheet.Range("$G$4:$G$8"), _ "NewName", , False, True, True, False
I want to do this programatically from VB.
Here is my code:
VB Code:
Set wAddin = OutputSheet.Application.Workbooks.Open(AddIns(1).FullName) Application.AddIns(AddIns(1).Title).Application.Run "Histogram", Sheet1.Range(strTemp), _ "NewName", , False, True, True, False
I get the error "The macro "Histogram" cannot found". I also tried a ! preceding Histogram ... same results ..
How can I make this work?
Thanks in advance for any help!
Outlook Addin Help!
I'm trying to develop an Outlook Addin in Visual Basic that places a button on the command bar, and captures the click event without using Office.CommandBars.
I've tried a few samples from the web, but none of them fire the function that I set in .OnAction
i.e. I set
...
.OnAction="=MySub()"
...
Private Sub MySub()
' do something
End Sub
Can anyone help me out with an example of this that works????
Outlook Com Addin Problem
I have written an Outlook Com Addin (VB6) that modifies the body of the mail message being sent. It adds a header to the begining of the message before it is sent. The problem is, if a forwarded message (that has an auto added signature) is sent, another signature is inserted into the message(body) prior to the header I add. If I look at the message during processing it is correct, however when you go back into outlook and open the message the additional siginature is inserted prior to the header. I have not been able to find where (programmatically) I can find how the signature is added and maybe I can turn it off. Any help would be greatly appreciated. Thanks in advance.
Want To Add COM Addin To Word Only, But Not Outlook
I have created an COM addin to Word. However, whenever i oped Outlook, the addin also runs. When outlook is beingd close, I will get an error: "Normal was being edited by another Word session. If you save this document with the original name, you will overwrite any changes made in the other session, xxxxxxxxxxxxx"
How could I prevent addin being run when Outlook is opened? I would like to restrict it to run only when MS Word is opened.
Outlook Addin Possibility
I'm wondering about the possibility of a project I've been thinking about. I want to make an addin for Outlook. At the click of a button, I want an email to be "cleaned" for forwarding. In other words, I'd remove any spaces longer than 2 nbsp, remove line spacing greater than say 2, remove any ">" characters, and do some other general formatting like removing long lists of email addresses.
I know how to do all the formatting stuff, but I'm wondering about the ease of making an addon to Outlook!? If it cannot be created as an Outlook addin, I guess I'll just have to make it as a seperate app.
Thoughts?
Outlook Addin Problem
Hi i ahve a COm addin for outlook in vb6 as part of this addin i need to create a new email and add rich text to the body of the mail, the rich text property is accesed using the outlook redemption file like so:
Dim strRTFMessage As String
strRTFMessage = txtProblem.TextRTF
Dim SafeItem, oItem
Set SafeItem = CreateObject("Redemption.SafeMailItem") 'Create an instance of Redemption.SafeMailItem
Set oItem = Application.CreateItem(0) 'Create a new message
SafeItem.Item = oItem 'set Item property
SafeItem.Recipients.Add "david.oliver@proquis.com"
SafeItem.Recipients.ResolveAll
SafeItem.subject = "Testing Redemption"
SafeItem.Display
SafeItem.BodyFormat = olFormatRichText
SafeItem.RTFBody = strRTFMessage
however when displayed the body of the message appears to be blank? I know the strRTFMessage is populated with rich text,
thanks for any help on this
Outlook 2000 COM Addin
I have a COM addin that adds 2 buttons to the outlook message windows and they seem to work only on the first time I install the add-in, and every time after the event handler for both buttons gets mapped to the first. For example, in the code below button1 pops up a messagebox that says Action1 and button2 pops up a messagebox saying Action2. On the first, after installation, everything works fine, but every time after button2 does nothing and button1 pops up both message boxes. I'm not sure if somehow the inspectors and event handlers are getting mixed up, any help, comments, criticisms, etc. would be greatly appreciated. Thanks in advance.
option Explicit
Implements IDTExtensibility2
Dim goOutlook as Outlook.Application
Dim withevents goInspectors as Outlook.Inspectors 'handle inspector events so we can detect when user is creating a newmail message
Dim withevents Button1 as Office.CommandBarButton 'Action1
Dim withevents Button2 as Office.CommandBarButton 'Action2
'OnConnection - this is called by Outlook when the addin is first connected (loaded)
private Sub IDTExtensibility2_OnConnection(byval Application as Object, byval ConnectMode as AddInDesignerObjects.ext_ConnectMode, byval AddInInst as Object, custom() as Variant)
on error resume next
set goOutlook = Application 'store outlook application object so we can use it later
set goInspectors = goOutlook.Inspectors 'store the inspectors object so we can detect when the user is composing a new mail message
End Sub
private Sub goInspectors_NewInspector(byval Inspector as Outlook.Inspector)
on error resume next
'see if our button already exist on the commandbar
Dim oBar as Office.CommandBar
set oBar = Inspector.CommandBars("Standard")
set Button1 = oBar.FindControl(Type:=msoControlButton, Id:=oBar.Controls("Action1").Id)
set Button2 = oBar.FindControl(Type:=msoControlButton, Id:=oBar.Controls("Action2").Id)
'if they do not, then add it to the controlbar
If Button1 is nothing then
set Button1 = oBar.Controls.Add(Type:=msoControlButton)
Button1.Caption = "Action1"
Button1.ToolTipText = "Action1 message text"
Button1.Tag = "Action1"
Button1.OnAction = "!<myOutlook.Connect>"
End If
If Button2 is nothing then
set Button2 = oBar.Controls.Add(Type:=msoControlButton)
Button2.Caption = "Action2"
Button2.ToolTipText = "Action2 message text"
Button2.Tag = "Action2"
Button2.OnAction = "!<myOutlook.Connect>"
End If
'use the same icon as the Send button for our button
Dim oSendButton as Office.CommandBarButton
set oSendButton = oBar.FindControl(Type:=msoControlButton, Id:=oBar.Controls("Send").Id)
'only try setting the properties if found the Send button
If Not oSendButton is nothing then
Button1.Style = msoButtonIconAndCaption
Button1.FaceId = oSendButton.FaceId
Button2.Style = msoButtonIconAndCaption
Button2.FaceId = oSendButton.FaceId
End If
'only show our button if this is a mail message
If Inspector.CurrentItem.Class = olMail then
Button1.Visible = true
Button2.Visible = true
else
Button1.Visible = false
Button2.Visible = false
End If
End Sub
private Sub Button1_Click(byval Ctrl as Office.CommandBarButton, CancelDefault as Boolean)
on error resume next
MsgBox ("Action1")
End Sub
private Sub Button2_Click(byval Ctrl as Office.CommandBarButton, CancelDefault as Boolean)
on error resume next
MsgBox ("Action2")
End Sub
private Sub IDTExtensibility2_OnStartupComplete(custom() as Variant)
End Sub
private Sub IDTExtensibility2_OnAddInsUpdate(custom() as Variant)
End Sub
private Sub IDTExtensibility2_OnBeginShutdown(custom() as Variant)
End Sub
private Sub IDTExtensibility2_OnDisconnection(byval RemoveMode as AddInDesignerObjects.ext_DisconnectMode, custom() as Variant)
set goOutlook = nothing
set goInspectors = nothing
set Button1 = nothing
set Button2 = nothing
End Sub
private Sub oMyExplorer_Activate()
End Sub
Outlook COM Addin Problem With Installation
I am having a problem distributing my COM addin for Outlook. The program works terrifically, but when I try to package it for distribution using the Visual Studio Installer program, it seems to work but then does not run when as it should when I start Outlook.
I think it may be a problem with the registry settings but cannot seem to pinpoint it. Does the DLL file have to be in a certain place? I have it installed under the Program Files/MyProgram directory.
Any ideas or suggestions would be GREATLY appreciated. Thanks.
Com Addin For Outlook 2003 - Get Body
Hi all, I'm trying to find some information on how to access the subject and body of the current high ligthed mail (or even just the seltext). Anyway it appears that I'm to stupid to use google or the search engine here. Could anybody point out to me where to get this info? Hmm okay its an dll I've done its working fine but I somehow don't get this stuff out of OTL into my DLL. Thanks in advance, Mike
Outlook PropertyPage Calls Addin.Sub?
Hello,
I got a PropertyPage added to the Outlook Options.
To accomplish that I had (?) to create an ActiveX device and needed to compile it.
But now how can I within that PropertyPage a Sub in the real Addin?
(In .NET the property page is in the same projekt as the Addin but in VB 6.0 I was told it has to be a standalone device but still I need the Addin subs)
Thank you,
Mat.
ActiveExplorer Outlook 2003 Com Addin
I am working on a Com Addin in Outlook that works fine in Outlook 2000 and XP. Unfortunately there are problems running it in Outlook 2003. I have tracked down the problem and it is related to the ActiveExplorer object. My project has a class that contains a collection of classes, one instance of the class for each open Explorer. The problem occurs when I am trying to determine which one of the open explorers is the ActiveExplorer. I loop through the my class collection and try to determine which of classes Explorers is the active one. This is even a problem when only one Explorer is open.
Any ideas?
Simmy
Addin - Outlook - Send Button
Hi,
I am trying to write a com addin for outlook that scan the message content after the user click the 'send' button. I have used the wizard and implemented the IDTExtensibility2 and it connects to the outlook. However I don't know how to catch the event when the user clicks the 'send' button. I saw an example from "microeye" website for catching the New message event by implementing "Private Sub goInspectors_NewInspector(ByVal Inspector As Outlook.Inspector) " but it does not work for me.
Any help is highly appriciated
Register AddIn For Outlook Fails
I´ve written a simple sample AddIn for Microsoft Outlook with a reference to MSOUTL9.OLB. When I use this DLL on my machine with Outlook 2003 it works fine. Even a Virtual XP machine with Outlook 2000 works fine (VMWare), but another real PC with Outlook 2000 can´t register the DLL. It comes with:
RegSvr32
DllRegisterServer in \Path...Project_AddIn.dll failed.
Code 0x80004005
After that I thought a distributing file MSI would work. Onfortunely it doesnt, and created the error:
Failed to register: HRESULT -2147467259.
What did I do wrong? This user is Administrator.
Outlook 2003 Com Addin+vb6.0 Usercontrol
i have created a com addin for outlook 2003.i have used ocx project for displaying custom property pages.
i have installed sucesssfully in outlook 2002.
it runs smoothly.
but in 2003 outlook it is giving an error message.
please help me
Outlook Com Addin Launch Msg File
I have .msg file( outlook email) and successfully loaded the msg file into
the outlook in the notes folder. However, I can't launch the loaded email.
Here is how I did in order to launch the outlook note.
Dim otlkDoc as Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objMAPIFolder As Outlook.MAPIFolder
Dim objMailItem As Outlook.MailItem
Set objMAPIFolder = objNameSpace.GetDefaultFolder(olFolderInbox)
Set objMailItem = otlkDoc.CreateItemFromTemplate(str_FileName)
objMailItem.Move objMAPIFolder
objMailItem.Save
objMailItem .Display 1
Put Outlook AddIn In SysTray When Running
Hello,
I would like to put an icon in the Systray to indicate that my Outlook COM AddIn is loaded, and remove the icon whenever the User unloads the AddIn.
All the sample code I've seen requires that you display a form before the icon appears in the SysTray. My AddIn's running in the background initially when loaded - there is no form associated with it until some action triggers it.
I'm using this typical function and getting an error with the "hwnd " variable because there's no window associated with the AddIn. I guess it needs to show up in the Outlook window??
VB Code:
'user defined type required by Shell_NotifyIcon API call Public Type NOTIFYICONDATA cbSize As Long hwnd As Long uId As Long uFlags As Long uCallBackMessage As Long hIcon As Long szTip As String * 64 End Type 'constants required by Shell_NotifyIcon API call: Public Const NIM_ADD = &H0 Public Const NIM_MODIFY = &H1 Public Const NIM_DELETE = &H2 Public Const NIF_MESSAGE = &H1 Public Const NIF_ICON = &H2 Public Const NIF_TIP = &H4 Public Const WM_MOUSEMOVE = &H200 Public Const WM_LBUTTONDOWN = &H201 'Button down Public Const WM_LBUTTONUP = &H202 'Button up Public Const WM_LBUTTONDBLCLK = &H203 'Double-click Public Const WM_RBUTTONDOWN = &H204 'Button down Public Const WM_RBUTTONUP = &H205 'Button up Public Const WM_RBUTTONDBLCLK = &H206 'Double-click Public Declare Function SetForegroundWindow Lib "user32" _ (ByVal hwnd As Long) As Long Public Declare Function Shell_NotifyIcon Lib "shell32" _ Alias "Shell_NotifyIconA" _ (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean Public nid As NOTIFYICONDATA Public Sub LoadSystray() With nid .cbSize = Len(nid) .hwnd = Me.hwnd ' ERROR ON THIS LINE- CJ .uId = vbNull .uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE .uCallBackMessage = WM_MOUSEMOVE .hIcon = Me.Icon .szTip = "Your ToolTip" & vbNullChar End With Shell_NotifyIcon NIM_ADD, nidEnd Sub Private Sub UnloadSystray(Cancel As Integer) 'this removes the icon from the system tray Shell_NotifyIcon NIM_DELETE, nid End Sub
Can someone advise me on how to accomplish this correctly?
Thank you,
CJ
Outlook Addin Launching Msg File
I have .msg file( outlook email) and successfully loaded the msg file into
the outlook in the notes folder. However, I can't launch the loaded email.
Here is how I did in order to launch the outlook note.
Dim objNameSpace As Outlook.NameSpace
Dim objMAPIFolder As Outlook.MAPIFolder
Dim objMailItem As Outlook.MailItem
Set objMAPIFolder = objNameSpace.GetDefaultFolder(olFolderNotes)
Set objNoteItem = otlkDoc.CreateItemFromTemplate(str_FileName)
objNoteItem.Move objMAPIFolder
objNoteItem.Save
objNoteItem.Display 1
ActiveExplorer Outlook 2003 Com Addin
I am working on a Com Addin in Outlook that works fine in Outlook 2000 and XP. Unfortunately there are problems running it in Outlook 2003. I have tracked down the problem and it is related to the ActiveExplorer object. My project has a class that contains a collection of classes, one instance of the class for each open Explorer. The problem occurs when I am trying to determine which one of the open explorers is the ActiveExplorer. I loop through the my class collection and try to determine which of classes Explorers is the active one. This is even a problem when only one Explorer is open.
Any ideas?
Simmy
Outlook Addin Launch The Email( Msg File)
I have .msg file( outlook email) and successfully loaded the msg file into
the outlook in the inbox folder. However, I can't launch the loaded email.
Here is how I did in order to launch the outlook note.
Dim otlkDoc as Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objMAPIFolder As Outlook.MAPIFolder
Dim objMailItem As Outlook.MailItem
Set objMAPIFolder = objNameSpace.GetDefaultFolder(olFolderInbox)
Set objMailItem = otlkDoc.CreateItemFromTemplate(str_FileName)
objMailItem.Move objMAPIFolder
objMailItem.Save
objMailItem.Display 1
How Access The Function Of A Outlook Com Addin Connect.dsr
I have a public function in the connect.dsr of an outlook addin that populates a combo box on my commandbar with cases#s parsed from an open web page. My addin also has a form that pulls the select case open and I want to have the combobox refresh automatically when I close the form. How can I reference the function in the connect.dsr? I tried moving the function to a module but then it doesn't work at all on the combobox. Is there way to do this?
Outlook 2003 – Addin That Is Sorting Correspondence
I have managed to create an addin that is sending msgbx on connection
Now I need to change it to sort out correspondence on arrival.
Can anyone tell me how to activate addin on email arrival or have addin waiting in background for any incoming messages?
Probelm Deleting Mail In Outlook COM Addin
Have created a COM Addin to remove mail from Outlook (Exchange) to our file system with an option to delete mail once they have been saved. I am using an Outlook View Control but my problem is that mail selected in the normal mailbox window (Generally the top item by default) won't delete and returns an error. I presume this is because it is selected. Any ideas on how I can solve this one?
Creating An Outlook Form Toolbar In An Addin
I'm not having any luck finding an answer to this. I am creating an Outlook 2000 addin. In the OnConnect event it needs to create a toolbar and command button.
I can do this on the main Outlook program, but it would be useful if the user could also have one when viewing the email on the separate form. You can manually add a custom toolbar/button, but not programmatically.
Does anyone know how to access the Toolbars group on the forms?
thanks,
Kevin
Newbie: How To Create An Outlook Addin Button?
Hi,
I am a Delphi programmer but there is a difficulty with Delphi in creating Addins for Outlook (or any office applications), therefore I have invested in Visual basic 6 as I have heard that it is relatively easiy in
VB to create an addin for Outlook.
I need to create an addin that places a button within outlook to save the currently highlighted email into a folder (path to be set via an ini file) and named as the current date&time, eg, 20060806-203010.msg
yyyymmdd-hhmmss
Does anyone have any sample code that does this type of thing as this is the first time that I have ever used VB.
thanks (hopefully).
Jon
Outlook Addin - Adding A Command Bar Button
I am writing an Outlook addin which adds a commandbar button to outlook, and when this button is clicked I would like it to execute a function.
Part of the addin is working that it adds the button, however it is not executing the code when it is clicked.
Here is my code.
Option Explicit
Implements IDTExtensibility2
Public objApp As New Outlook.Application
Public WithEvents oMailItem As Outlook.MailItem
Public WithEvents oExplorer As Outlook.Explorer
Public WithEvents oMailItem2 As Outlook.MailItem
Private Sub IDTExtensibility2_OnStartupComplete(custom() As Variant)
' on start up
Dim oExplorer As Object
Set oExplorer = objApp.ActiveExplorer
'Dim objInspector As ThisOutlookSession.ActiveExplorer
Dim objBars As Object
Set objBars = oExplorer.CommandBars.Item("Standard")
Dim Con As Object
Set Con = objBars.FindControl(Type:=msoControlButton, Id:=1)
If Con.FaceId <> 279 And Con.Caption <> "Junk Mail" Then
Set Con = objBars.Controls.Add(Type:=msoControlButton, Id:=1, Before:=2) 'The button will be number 2, after the mail button
Con.FaceId = 279
Con.Style = msoButtonIconAndCaption
Con.Caption = "Junk Mail"
Con.DescriptionText = "Junk Mail"
Con.OnAction = "JunkMail
MsgBox "addin starting"
End If
End Sub
Function JunkMail()
MsgBox "test"
End Function
For some reason it is not calling the junkmail function when clicked.
what am i doing wrong when i set the onaction property???
This code worked when it was a macro.
Any help with this would be greatly appreciated..
Outlook Addin - OnAction For New Command Bar Button
I am writing an Outlook addin which adds a commandbar button to outlook, and when this button is clicked I would like it to execute a function.
Part of the addin is working that it adds the button, however it is not executing the code when it is clicked.
Here is my code.
Option Explicit
Implements IDTExtensibility2
Public objApp As New Outlook.Application
Public WithEvents oMailItem As Outlook.MailItem
Public WithEvents oExplorer As Outlook.Explorer
Public WithEvents oMailItem2 As Outlook.MailItem
Private Sub IDTExtensibility2_OnStartupComplete(custom() As Variant)
' on start up
Dim oExplorer As Object
Set oExplorer = objApp.ActiveExplorer
'Dim objInspector As ThisOutlookSession.ActiveExplorer
Dim objBars As Object
Set objBars = oExplorer.CommandBars.Item("Standard")
Dim Con As Object
Set Con = objBars.FindControl(Type:=msoControlButton, Id:=1)
If Con.FaceId <> 279 And Con.Caption <> "Junk Mail" Then
Set Con = objBars.Controls.Add(Type:=msoControlButton, Id:=1, Before:=2) 'The button will be number 2, after the mail button
Con.FaceId = 279
Con.Style = msoButtonIconAndCaption
Con.Caption = "Junk Mail"
Con.DescriptionText = "Junk Mail"
Con.OnAction = "JunkMail
MsgBox "addin starting"
End If
End Sub
Function JunkMail()
MsgBox "test"
End Function
For some reason it is not calling the junkmail function when clicked.
what am i doing wrong when i set the onaction property???
This code worked when it was a macro.
Any help with this would be greatly appreciated..
VB6 COM Addin For Outlook -- Memory Leak / Icons
In my COM add-in based on VB6 I have a problem with this statement:
Set itms = frmAAA.ListView1.ListItems.Add(i, , aaStr, 1, 1)
It adds Icon and SmallIcon from an ImageList defined at design time.
But when the add-in trys to shut down, it doesn't go away, it is left in memory.
If I don't use the icons, then a clean shutdown happens.
So, if I instead use:
Set itms = frmAAA.ListView1.ListItems.Add(i, , aaStr)
it shuts down OK.
In my shutdown routine I try doing things like:
frmAAA.ListView1.ListItems.Clear
Set frmAAA.ListView1.Icons = Nothing
Set frmAAA.ListView1.SmallIcons = Nothing
But this doesn't help.
Any ideas on how to fix this and still display the icons?
Type Mismatch Addin Connection Outlook
Hi,
I'm trying to create an Add In for Outlook 2000.
I followed the steps in the microsoft place, and others, but always have the same error.
When the addin is connecting, I place a brekpoint at the first instruction (Set VBInstance = Application) and when I execute that line, I receive a Type mismatch error, code 13.
If I look at the contents of 'Application', it has "Outlook"
and VBInstance is defined as
Public VBInstance As VBIDE.VBE
private Sub AddinInstance_OnConnection(byval Application as Object, _
byval ConnectMode as AddInDesignerObjects.ext_ConnectMode, _
byval AddInInst as Object, custom() as Variant)
'
on error GoTo error_handler
'
'save the vb instance
set VBInstance = Application TYPE MISMATCH
Can anyone help????
Without this I can't go on, and I've been 2 days with this error, and don't know what to do.
Thanks,
Amota.
How To Allow Multiple Users To Access COM Addin Of Outlook
hi
, iam facing a problem with outlook 2003 COM addin,
i created a COM addin for outlook 2003 which extracts the emailid from emails in inbox and gives an option to user to save it to his database.
i logged in a system as admin and i installed that cmponent, i can see the COM bar in outlook, but when login as some other user who doesn't have admin level accesss privelages then it is not showing the COM addin even if i try to add that COM addin by registering it with regsvr32 "..."
it is giving error as the user doesn't have access to Registry
so i want that COM addin to be used by every one i mean the user who has got admin level previlages and as well as limited acess to system without changing the user aceess settings
Outlook Addin Launch The Email( Msg File)
I have .msg file( outlook email) and successfully loaded the msg file into
the outlook in the inbox folder. However, I can't launch the loaded email.
Here is how I did in order to launch the outlook note.
Dim otlkDoc as Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objMAPIFolder As Outlook.MAPIFolder
Dim objMailItem As Outlook.MailItem
Set objMAPIFolder = objNameSpace.GetDefaultFolder(olFolderInbox)
Set objMailItem = otlkDoc.CreateItemFromTemplate(str_FileName)
objMailItem .Move objMAPIFolder
objMailItem .Save
objMailItem .Display 1
Outlook Addin Put MailItem Into Inbox Folder
I am working on the outlook Com addin. seems like I can't get my email
into Inbox folder. Here is the source.
Dim objApp As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objMAPIFolder As Outlook.MAPIFolder
Dim objMailItem As Outlook.MailItem
Set objNameSpace = objApp .GetNamespace("MAPI")
Set objMailItem = objApp .CreateItem(olMailItem)
Set objMAPIFolder = objNameSpace.GetDefaultFolder(olFolderInbox)
'load msg file
Set objMailItem = otlkDoc.CreateItemFromTemplate(str_FileName)
objMailItem.Move( objMAPIFolder )
objMailItem.Display (0)
Outlook Addin - Adding Separator To Tools Menu?
Writing a simple addin for Outlook & trying to add a separator to the Tools menu before a number of menu options that will be available to the user. Expected that just setting the caption to "-" as with the menu editor would create the separator, but this doesn't work. Can anyone help?
thanks
Set OLApp = Application
Set OutlookCmdBars = OLApp.ActiveExplorer.CommandBars
'Add buttons to the Tools menu in Outlook, as there are several tools...
Set HookMenuBar = OutlookCmdBars("Tools")
'Separator into the menu first...
Set TmpCmdBarButton = HookMenuBar.Controls.Add(Type:=msoControlButton, Temporary:=True)
TmpCmdBarButton.Style = msoButtonCaption
With TmpCmdBarButton
.Caption = "-"
.Enabled = True
End With
...rest of menu adding code...
Detect MailItem Events For Outlook 2000 Addin
I've started doing an Outlook 2000 addin and everything was going fine untill I was not able to detect events for mailitems.
The events do not fire... What do I need to make them fire?
Thanks
Add A Checkmark To Outlook AddIn On Tools Menu- RESOLVED
Hello,
My DLL COM AddIn for Outlook is listed as a menu item. When the User selects it and some event occurs, I handle the event.
I need to turn the AddIn Off or On based on whether the AddIn menu item is checked or unchecked by the User.
How do I toggle the check mark on and off next to the AddIn - indicating that it is selected or not?
I tried using the Checked property, but I know it can only be used on Menu objects - mine is a CommandBarButton object.
Thanks for any help
CJ
Annoying Problem With MsgBoxes And Focus Of Outlook Application (making A COM Addin)
"MsgBox x" from a dll outlook com addin will result in outlook appear to be "frozen", and the msgbox will appear behind the window.. people might think outlook is crashed because they cant see the msgbox that has loaded behind outlook itself.
"MsgBox x, vbSystemModal" makes the msgbox open in front of outlook so it can be clicked, but it has a tendency to remove focus from outlook completely so that the msgbox is shown with the desktop in the background instead of outlook. Also, it will cause Outlook to not be able to restore focus at all.. Ill click Outlook in the taskbar but it wont appear (but the button on the taskbar will be 'selected').. and rightclicking Outlook on the taskbar shows that 'restore' is greyed out..
Argh.. how can i get the msgbox to show like its supposed to?
Office Com Addin Click Addin Button By Program
is there any way to click the button by program?
I have this
Dim WithEvents cbcButton As Office.CommandBarButton
inside of connect.cls. When addin button is clicked
event
Public Sub cbcButton_Click(ByVal ctrl As Office.CommandBarButton, CancelDefault As Boolean)
is called. I want to call this function from module. In order for that,
I have another public g_Button as Office.CommandBarButton in module
and at the IDTExtensibility2_OnStartupComplete I am linking to this global
button by
set g_Button = cbcbutton_Click.
after that inside of this connect class I can call g_Button.execute to call cbcbutton_Click However, if I do the same thing in another module
"fail method "execute" '_CommandBarButton' object message appears and
doesn't do anything?
is there any way to avoid this and click this button by program.
I was wondering if I can click this addin button by sendmessage or sendkey
Let me know if anyone has an idea.
bE
Outlook Addin - Toolbar In "New Mail Message" Window
Hi all,
I want to add toolbar or menu on "new message" window only in outlook 2000 and geater. I can't find any clue on how to add addins only in new message window. The purpose of this plugin is to let user record their voice message and attach it to the mail.
So i have two questions.
1) how can i add toolbar or menu COM addin in "new message" window.
2) how can i attach a file to this currenly open "new message" window.
plz help me in this regard, thanks in advance
Regards,
Naveed.
Outlook Macro Help
I am trying to figure out how to create a macro or tool bar button that when ran, takes the currently selected email and forwards it to a predefined address. I thought before I start from scratch, I would check here to see if anyone has already done something like this?
Outlook Macro
I have created a macro in Outlook, complied, and saved it. It will not show up in the Macro list. I have lowered the Security levels, restarted Outlook, and it will not show up. Any suggestions???
Outlook Macro
Hi All!
I know this kind-of-question has been asked before, but this one's different.
I would like to move all messages in public folder (exchange): X to folder Y.
But, before it moves the message I would like to save the attachments of the message to let's say: C:Attachments.
Can anyone please help me with this?
I can't seem to figure this out; i'm also not very familiar with Outlook macro's.
I've been trying this for a few hours already, so help would be greatly appreciated.
Thanks a lot!
Kevin,
I Need Help With An Outlook Macro...
I am writing a macro for MS Outlook 2000, and I need some help with the code. What I need is a macro that will search all the messages in the Inbox for a particular subject, and then for each one it finds it calls a subroutine. I already have the subroutine written, I just need to know how to search the messages and return the body of the message as a text string. Is this possible? If so, could you give me some example code?
Thanks for the help!
-Droakir
Using Macro In Outlook. Please Help!!!
Hi guys,
Please help me out on this. Im really new to Visual Basic and macro stuff. While I was trying to help ma dad to send the same email to the everyone in his address book(about 1300 customers), I encountered a problem with his email server. It does not allow more than 50 emails outgoing at a time. So, I was trying to create a macro to automatically bring out the fifty emails at a time and send the message. I tried 8 hours on it, but could not figure out. Can someone tell me or get me a sample macro code please!!!!!!!
Need Outlook Macro Help
Hi,
Can anyone help me out?
Im trying to make a small macro that paste a pre-defined text to a mail that I replyed to.
What I want it to do is:
I recieve the mail and click reply and click a macro button that paste the text to the body of the reply.
Thanks!!
Regards
Exeriaa
Outlook Macro Help
I'm looking for two macros in Outlook XP (and am a VB newbie). I wonder if anyone could point me to macros or code examples that might help.
I would like macros for the following purposes:
1). sendmail.dll in Windows XP has changed from Win2k. In Win2k, when you send a page as an email from IE, the body of the page is placed in the body of the email and the title of the email is set to the <TITLE> of the page. In XP, the body of the bage is correctly placed in the body of the email, but the title of the email is set to the word "Emailing: " followed by the last part of the URL.
I send about 200 pages a day this way, so, though I can copy the title of the page into the subject of the email, I'd like to find a macro to do this: Set the subject of the email to the text between <TITLE> and </TITLE>.
2). I use multiple .pst files and have a lot of email traffic. I frequently need to compact the .pst files. Is there any macro that will compact all open .pst files.
Thanks in advance for any assistance!
Ms Outlook Macro
Hi!
I want to know about the an API call, with which I can rename a folder in MS OUTLOOK.
For example, if through a macro I want to change the folder name "Inbox" to "Personal", what API call do I use?
Thanks
|