D
David Kaplan
I've created my first VBA app which runs great, but then after I shut
down Outlook and restart I receive the following error messages, and
would appreciate any assistance! DHK
====
Outlook experienced a serious error last time the add-in Microsoft VBA
for Outlook was opened. Would you like to disable this add-in?
To reactivate this add-in, click about Microsoft Office on the help
menu and then click disabled items.
=====
I do this and find the message: "Add-in: Microsoft VBA for Outlook
Add-in (outlvba.dll)" is disabled. I re-enable it and it works till
the next time I shut down!
Code is meant to copy a contact name/address to the clipboard, when it
is open in the business card format:
************************
Attribute VB_Name = "Module1"
Sub CopyToClipboard()
'Set up objects
Dim myOlApp As Object
Dim objItem As Object
Dim Response
Dim strToCopy As String
Dim strCompany As String
Set Clipboard = New DataObject
'Sets up an Outlook App for an Inspector
Set myOlApp = CreateObject("Outlook.Application")
'Check to ensure Outlook item is selected
If TypeName(myOlApp.ActiveInspector) = "Nothing" Then
MsgBox "Contact not open. Exiting", vbOKOnly + vbInformation
Exit Sub
End If
Set objItem = myOlApp.ActiveInspector.CurrentItem
If objItem.CompanyName = "" Then
strCompany = ""
Else
strCompany = objItem.CompanyName & vbCrLf
End If
If objItem.BusinessAddress <> "" Then
strToCopy = objItem.FullName & vbCrLf & strCompany &
objItem.BusinessAddress
Else
strToCopy = objItem.FullName & vbCrLf & strCompany &
objItem.HomeAddress
End If
Clipboard.SetText strToCopy
Clipboard.PutInClipboard
Response = MsgBox("Address Copied to Clipboard!", vbOKOnly)
Set myOlApp = Nothing
Set objItem = Nothing
Set Clipboard = Nothing
End Sub
down Outlook and restart I receive the following error messages, and
would appreciate any assistance! DHK
====
Outlook experienced a serious error last time the add-in Microsoft VBA
for Outlook was opened. Would you like to disable this add-in?
To reactivate this add-in, click about Microsoft Office on the help
menu and then click disabled items.
=====
I do this and find the message: "Add-in: Microsoft VBA for Outlook
Add-in (outlvba.dll)" is disabled. I re-enable it and it works till
the next time I shut down!
Code is meant to copy a contact name/address to the clipboard, when it
is open in the business card format:
************************
Attribute VB_Name = "Module1"
Sub CopyToClipboard()
'Set up objects
Dim myOlApp As Object
Dim objItem As Object
Dim Response
Dim strToCopy As String
Dim strCompany As String
Set Clipboard = New DataObject
'Sets up an Outlook App for an Inspector
Set myOlApp = CreateObject("Outlook.Application")
'Check to ensure Outlook item is selected
If TypeName(myOlApp.ActiveInspector) = "Nothing" Then
MsgBox "Contact not open. Exiting", vbOKOnly + vbInformation
Exit Sub
End If
Set objItem = myOlApp.ActiveInspector.CurrentItem
If objItem.CompanyName = "" Then
strCompany = ""
Else
strCompany = objItem.CompanyName & vbCrLf
End If
If objItem.BusinessAddress <> "" Then
strToCopy = objItem.FullName & vbCrLf & strCompany &
objItem.BusinessAddress
Else
strToCopy = objItem.FullName & vbCrLf & strCompany &
objItem.HomeAddress
End If
Clipboard.SetText strToCopy
Clipboard.PutInClipboard
Response = MsgBox("Address Copied to Clipboard!", vbOKOnly)
Set myOlApp = Nothing
Set objItem = Nothing
Set Clipboard = Nothing
End Sub