Outlook Vba Runtime Error 13
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the run time error 13 type mismatch workings and policies of this site About Us Learn more about Stack runtime error 13 type mismatch fix Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs
Runtime Error 13 Type Mismatch Vb6
Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join
Compile Error Type Mismatch Vba
them; it only takes a minute: Sign up VBA (Excel) Run time error 13 on for-each loop up vote 1 down vote favorite I have this odd problem with this code I found somewhere. I am trying to list all email in Excel within all sub folders from Outlook: I have searched and researched this for weeks without any run time error 13 type mismatch excel 2013 luck. 'Requires reference to Outlook library Option Explicit Public Sub ListOutlookFolders() Dim olApp As Outlook.Application Dim olNamespace As Outlook.Namespace Dim olFolder As Outlook.MAPIFolder Dim rngOutput As Range Dim lngCol As Long Dim olItem As Outlook.MailItem Dim rng As Excel.Range Dim strSheet As String Dim strPath As String Set rngOutput = ActiveSheet.Range("A1") Set olApp = New Outlook.Application Set olNamespace = olApp.GetNamespace("MAPI") For Each olFolder In olNamespace.Folders rngOutput = olFolder.Name rngOutput.Offset(0, 1) = olFolder.Description Set rngOutput = rngOutput.Offset(1) For Each olItem In olFolder.Items Set rngOutput = rngOutput.Offset(1) With rngOutput .Offset(0, 1) = olItem.SenderEmailAddress ' Sender End With Next Set rngOutput = ListFolders(olFolder, 1, rngOutput) Next Set olFolder = Nothing Set olNamespace = Nothing Set olApp = Nothing End Sub Function ListFolders(MyFolder As Outlook.MAPIFolder, Level As Integer, theOutput As Range) As Range Dim olFolder As Outlook.MAPIFolder Dim olItem As Outlook.MailItem Dim lngCol As Long For Each olFolder In MyFolder.Folders theOutput.Offset(0, lngCol) = olFolder.Name Set theOutput = theOutput.Offset(1) If (olFolder.DefaultItemType = olMailItem) And (Not olFolder.Name = "Slettet post") Then For Each olItem In olFolder.Items If olItem.Class = olMail Then
resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV Startups TechRewards Events Community Magazine Forums Blogs Channel 9 Documentation APIs and reference Dev centers Samples Retired content We’re sorry. The content you requested has been removed.
Run Time Error 13 Type Mismatch Access
You’ll be auto redirected in 1 second. Reference Trappable Errors Core Visual Basic Language Errors type mismatch vba access Core Visual Basic Language Errors 13 Type mismatch 13 Type mismatch 13 Type mismatch 3 Return without GoSub 5 Invalid procedure call or type mismatch vba string argument 6 Overflow 7 Out of memory 9 Subscript out of range 10 This array is fixed or temporarily locked 11 Division by zero 13 Type mismatch 14 Out of string space 16 Expression too complex 17 http://stackoverflow.com/questions/10121529/vba-excel-run-time-error-13-on-for-each-loop Can't perform requested operation 18 User interrupt occurred 20 Resume without error 28 Out of stack space 35 Sub, Function, or Property not defined 47 Too many DLL application clients 48 Error in loading DLL 49 Bad DLL calling convention 51 Internal error 52 Bad file name or number 53 Can't find specified file 54 Bad file mode 55 File already open 57 Device I\O error 58 File already exists 59 Bad record length 61 Disk https://msdn.microsoft.com/en-us/library/aa264979(v=vs.60).aspx full 62 Input past end of file 63 Bad record number 67 Too many files 68 Device unavailable 70 Permission denied 71 Disk not ready 74 Can't rename with different drive 75 Path\File access error 76 Path not found 91 Object variable or With block variable not set 92 For loop not initialized 93 Invalid pattern string 94 Invalid use of Null 96 Can't sink this object's events because it's already firing events... 97 Can't call Friend procedure on an object that isn't an instance of... 98 A property or method call cannot include a reference to a private ... 321 Invalid file format 322 Can't create necessary temporary file 400 Form already displayed; can't show modally 422 Property not found 429 ActiveX component can't create object or return reference to this... 430 Class doesn't support Automation 432 File name or class name not found during Automation operation 438 Object doesn't support this property or method 440 Automation error 442 Connection to type library or object library for remote process h... 443 Automation object doesn't have a default value 445 Object doesn't support this action 446 Object doesn't support named arguments 447 Object doesn't support current locale setting 448 Named argument not found 449 Argument not optional 450 Wrong number of arguments or invalid property assignment 451 Property let procedure not defined and property get procedur
Top Posters Today's Posts Search Community Links Social Groups Pictures & Albums Members List Calendar Search Forums Show Threads Show Posts Tag Search Advanced Search Find All Thanked Posts Go to Page... http://www.access-programmers.co.uk/forums/showthread.php?t=267428 Thread Tools Rate Thread Display Modes 07-30-2014, 01:56 AM #1 Squizzla Newly Registered User Join Date: Jan 2014 Posts: 5 Thanks: 2 Thanked 0 Times in 0 Posts Adding Attachments to Outlook - Runtime Error '13' Type Mismatch Hello everyone, I'm having a bit of bother with a Access VBA function that attaches files to an email and sends them to a specified list of addresses. Here is type mismatch the function: Code: Function SendEmail() As Boolean Dim olApp As Outlook.Application Dim olMailItemObject As Outlook.MailItem Dim objfile As Scripting.File Dim fso As New Scripting.FileSystemObject Dim bSucc As Boolean Dim hResult As Boolean On Error GoTo email_Err 'Create objects Set olApp = CreateObject("Outlook.application") Set olMailItemObject = olApp.CreateItemFromTemplate(Forms!frmMailer.lblTempPath.Caption) For Each objfile In fso.GetFolder(CurrentProject.Path & "\Temp Files").Files 'Add attachment olMailItemObject.Attachments.Add objfile.Path, objfile.Type NoFiles = NoFiles + 1 Next If NoFiles = 0 Then ErrString = time error 13 "No Attachments" GoTo email_Err End If 'Add recipient hResult = AddRecipients(olMailItemObject, Forms!frmMailer.lblEmail.Caption) 'Send email olMailItemObject.Recipients.ResolveAll olMailItemObject.Send 'Success SendEmail = True bSucc = True email_Err: 'Release pointers Set olMailItemObject = Nothing Set olApp = Nothing Set fso = Nothing If bSucc = False And ErrString = "" Then ErrString = "Could not email Recipients" End Function The issue I'm having is the Code: olMailItemObject.Attachments.Add objfile.Path, objfile.Type line, which it fails on giving me run-time error '13' - Type mis-match. A little liberal googling has failed to help, so I was hoping someone here would have an idea of what's going wrong & how to fix it. Thanks Squizzla View Public Profile Find More Posts by Squizzla 07-30-2014, 06:34 AM #2 pbaldy Wino Moderator Join Date: Aug 2003 Location: Nevada, USA Posts: 28,935 Thanks: 6 Thanked 3,238 Times in 3,184 Posts Re: Adding Attachments to Outlook - Runtime Error '13' Type Mismatch Shot in the dark but try dropping the last bit: olMailItemObject.Attachments.Add objfile.Path __________________ Paul Microsoft Access MVP To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. The Following User Says Thank You to pbaldy For This Useful Post: Squizzla(07-30-2014) pbaldy View Public Prof