View Full Version : vba (range command) in outlook 2007
maheshkzm
01-08-2010, 01:40 AM
Dear Team,
This vba macro has been working fine on Outlook 2003 so far. I had to copy paste this macro to Outlook 2007 today.
I get the following error:
Compiler error
User-defined type not defined
THis error occurs at the following statement:
Dim oStory As Range
Please advice, THanks...
Mahesh
RolfJ
01-08-2010, 07:23 AM
It seems that you might have forgotten to establish a reference to the Excel Object library (in VBE: Tools | References).
It seems that you might have forgotten to establish a reference to the Excel Object library (in VBE: Tools | References).
... or is it a Word Range?
maheshkzm
01-11-2010, 02:33 AM
Hi,
Im trying to process the email body so i proceeded to include the Word.Range
I still get the following error:
Run-time error '429':
ActiveX component can't create object
I then click on Debug. The tooltip error shows the following :
ActiveDocument.StoryRanges=<Object variable or With block variable not set>
Here is the full code:
Sub a2()
Dim rngStory As Word.Range
For Each rngStory In ActiveDocument.StoryRanges
With rngStory.Find
.Text = "find text"
.Replacement.Text = "I'm found"
.Wrap = wdFindContinue
.Execute Replace:=wdReplaceAll
End With
Next rngStory
End Sub
Thanks, mahesh
maheshkzm
01-11-2010, 02:34 AM
yes, btw..i have included both Excel and Word object libraries in the Tools/References.
RolfJ
01-11-2010, 06:45 PM
I checked out your code and can't seem to see anything wrong with it. Sorry, I have no further suggestions.
maheshkzm
01-11-2010, 07:24 PM
Thanks RolfJ, I just came across something. WHen i open word(just leave it open on your pc) and then run this macro from outlook. No Errors!!!!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.