|
-
Feb 27th, 2006, 08:29 AM
#1
Thread Starter
Junior Member
Office 2003, VB6 problem
Hi
I am busy making an app that searches through all items in my inbox and saves certain types of attachments to a specified folder.
However when i run my program i get the an error
"Automation error, The specified module could not be found"
Under the references i have "Microsoft Outlook 11.0 Object library" ticked as well as a couple others.
the error occurs when the following line is executed
VB Code:
Set oOutlook = New Outlook.Application
the part of code is below
VB Code:
Dim oOutlook As Outlook.Application
Dim oNs As Outlook.NameSpace
Dim oFldr As Outlook.MAPIFolder
Dim oMessage As Object
Dim sPathName As String
Dim oAttachment As Outlook.Attachment
Dim iCtr As Integer
Dim iAttachCnt As Integer
If txtPath = "" Then
MsgBox "Enter a path to save attachments to!", vbExclamation + vbOKOnly, "Path problem"
Else
sPathName = txtPath.Text
If Right(sPathName, 1) <> "\" Then sPathName = sPathName & "\"
If Dir(sPathName, vbDirectory) = "" Then FileSystem.MkDir (sPathName)
[COLOR=Red] Set oOutlook = New Outlook.Application[/COLOR]
Set oNs = oOutlook.GetNamespace("MAPI")
Set oFldr = oNs.GetDefaultFolder(olFolderInbox)
Any help would be greatly appreciated.
Thanks
Nath
-
Feb 28th, 2006, 02:06 AM
#2
Thread Starter
Junior Member
Re: Office 2003, VB6 problem
Hi
Just a little something else i discovered, if outlook 2003 is open when i run the program and i change
VB Code:
Set oOutlook = New Outlook.Application
to
VB Code:
Set oOutlook = Outlook.Application
then it works. so there seems to be a problem with the "new" but i still dont know how to correct it....
Nath
-
Feb 28th, 2006, 04:14 AM
#3
Re: Office 2003, VB6 problem
If your adding a reference to Outlook then the Set oOutlook = New Outlook.Application will work. If your not setting a reference to Outlook then use Set oOutlook = CreateObject("Outlook.Application") and that will create the instance. The reason why Set oOutlook = Outlook.Application works if Outlook is running is because its already created. If its not running then it will error.
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Feb 28th, 2006, 07:49 AM
#4
Thread Starter
Junior Member
Re: Office 2003, VB6 problem
Hi
I have tried what you said and i still get the "Automation error, The specified module could not be found" error.
It does this if i have the reference included and use
VB Code:
Set oOutlook = New Outlook.Application
it also happens if i use no reference and
VB Code:
Set oOutlook = CreateObject("Outlook.Application")
could this possibly be a problem with my outlook installation??
-
Feb 28th, 2006, 10:07 AM
#5
Re: Office 2003, VB6 problem
Yes, it could be. Try a Detect and Repair from Outlooks help menu and maybe an Office Update.
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|