From: Ed from AZ on
I have a macro in Word that iterates through my Favorites folder and
saves everything out as hyperlinks in a Word doc. I then SaveAs using
doc.SaveAs FileName:= _
"C:\Documents and Settings\edward.millis\Documents\MyFaves.htm",
_
FileFormat:=wdFormatHTML

This macro was written in Word XP, which has now been upgraded to
2007. The OS has also been updated from WinXP Pro to Vista Pro.

When I run the macro in Word only, it runs fine - the file is
generated and saved to the correct folder in the correct format.

I want to email the file out, so I am trying to run it from within an
Outlook 2007 macro. (Security settings prevent Word VBA from
accessing OL VBA, or I would do it all from within Word.)

The OL macro creates the Word instance just fine and runs the macro
just fine - until it hits the SaveAs. I put a STOP in the Word code
just before the SaveAs to verify this - as soon aas I F8 to the
SaveAs, my error handler tells me that Outlook VBA has the following
error:
-2147417851
Method "Run" of object "Application" failed

Any suggestions on getting this macro to run when accessed from OL
VBA?
Ed
From: Ken Slovak - [MVP - Outlook] on
That file path shouldn't exist at all on a Vista system. Does the exact same
code really run in Word on Vista without errors? In any case, if there's a
Word error going on the problem isn't an Outlook problem but a Word problem.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Ed from AZ" <prof_ofwhat(a)yahoo.com> wrote in message
news:6a026697-8927-4b89-a9c0-7d10588a014a(a)g28g2000yqh.googlegroups.com...
>I have a macro in Word that iterates through my Favorites folder and
> saves everything out as hyperlinks in a Word doc. I then SaveAs using
> doc.SaveAs FileName:= _
> "C:\Documents and Settings\edward.millis\Documents\MyFaves.htm",
> _
> FileFormat:=wdFormatHTML
>
> This macro was written in Word XP, which has now been upgraded to
> 2007. The OS has also been updated from WinXP Pro to Vista Pro.
>
> When I run the macro in Word only, it runs fine - the file is
> generated and saved to the correct folder in the correct format.
>
> I want to email the file out, so I am trying to run it from within an
> Outlook 2007 macro. (Security settings prevent Word VBA from
> accessing OL VBA, or I would do it all from within Word.)
>
> The OL macro creates the Word instance just fine and runs the macro
> just fine - until it hits the SaveAs. I put a STOP in the Word code
> just before the SaveAs to verify this - as soon aas I F8 to the
> SaveAs, my error handler tells me that Outlook VBA has the following
> error:
> -2147417851
> Method "Run" of object "Application" failed
>
> Any suggestions on getting this macro to run when accessed from OL
> VBA?
> Ed

From: Ed from AZ on
> That file path shouldn't exist at all on a Vista system.

Wow! I copied it straight off the folder address bar - I thought.
The address bar shows the heirarchy separated by >, but when you click
in it it turns to /. I'll have to look at that again. But yes, when
run from Word, there are no problems. Well, maybe not - it's
overwriting a file that's already there, so maybe the newly save file
is disappearing into the system somewhere and I'm actually still
seeing the previous version.

Gotta look at that again! Thanks, Ken. At least I have a good point
to start looking.
Ed

On Mar 2, 1:54 pm, "Ken Slovak - [MVP - Outlook]" <kenslo...(a)mvps.org>
wrote:
> That file path shouldn't exist at all on a Vista system. Does the exact same
> code really run in Word on Vista without errors? In any case, if there's a
> Word error going on the problem isn't an Outlook problem but a Word problem.
>
> --
> Ken Slovak
> [MVP - Outlook]http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm
>
> "Ed from AZ" <prof_ofw...(a)yahoo.com> wrote in messagenews:6a026697-8927-4b89-a9c0-7d10588a014a(a)g28g2000yqh.googlegroups.com...
>
>
>
> >I have a macro in Word that iterates through my Favorites folder and
> > saves everything out as hyperlinks in a Word doc.  I then SaveAs using
> >  doc.SaveAs FileName:= _
> >      "C:\Documents and Settings\edward.millis\Documents\MyFaves.htm",
> > _
> >      FileFormat:=wdFormatHTML
>
> > This macro was written in Word XP, which has now been upgraded to
> > 2007.  The OS has also been updated from WinXP Pro to Vista Pro.
>
> > When I run the macro in Word only, it runs fine - the file is
> > generated and saved to the correct folder in the correct format.
>
> > I want to email the file out, so I am trying to run it from within an
> > Outlook 2007 macro.  (Security settings prevent Word VBA from
> > accessing OL VBA, or I would do it all from within Word.)
>
> > The OL macro creates the Word instance just fine and runs the macro
> > just fine - until it hits the SaveAs.  I put a STOP in the Word code
> > just before the SaveAs to verify this - as soon aas I F8 to the
> > SaveAs, my error handler tells me that Outlook VBA has the following
> > error:
> >  -2147417851
> >  Method "Run" of object "Application" failed
>
> > Any suggestions on getting this macro to run when accessed from OL
> > VBA?
> > Ed- Hide quoted text -
>
> - Show quoted text -

From: Ken Slovak - [MVP - Outlook] on
I don't know, your setup may be different, but here on one of my Vista
setups a document in my Documents folder has a path that looks like this:
C:\Users\Ken Slovak.000\Documents\9096xcc.doc.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Ed from AZ" <prof_ofwhat(a)yahoo.com> wrote in message
news:3ec2eba3-fe84-41f1-80e1-8c9bd5898755(a)f17g2000prh.googlegroups.com...
> That file path shouldn't exist at all on a Vista system.

Wow! I copied it straight off the folder address bar - I thought.
The address bar shows the heirarchy separated by >, but when you click
in it it turns to /. I'll have to look at that again. But yes, when
run from Word, there are no problems. Well, maybe not - it's
overwriting a file that's already there, so maybe the newly save file
is disappearing into the system somewhere and I'm actually still
seeing the previous version.

Gotta look at that again! Thanks, Ken. At least I have a good point
to start looking.
Ed

From: "Tony Jollans" My forename at my surname dot on
Vista will allow you to use that name as an alternative to the
Users\(userid)\Documents name.

Are you using Application.Run (as per the message)? Or is the code exactly
as posted - which ought to work (assuming doc is a valid reference)?

--
Enjoy,
Tony

www.WordArticles.com

"Ken Slovak - [MVP - Outlook]" <kenslovak(a)mvps.org> wrote in message
news:%23O0vKqkuKHA.6140(a)TK2MSFTNGP05.phx.gbl...
> That file path shouldn't exist at all on a Vista system. Does the exact
> same code really run in Word on Vista without errors? In any case, if
> there's a Word error going on the problem isn't an Outlook problem but a
> Word problem.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.
> http://www.slovaktech.com/products.htm
>
>
> "Ed from AZ" <prof_ofwhat(a)yahoo.com> wrote in message
> news:6a026697-8927-4b89-a9c0-7d10588a014a(a)g28g2000yqh.googlegroups.com...
>>I have a macro in Word that iterates through my Favorites folder and
>> saves everything out as hyperlinks in a Word doc. I then SaveAs using
>> doc.SaveAs FileName:= _
>> "C:\Documents and Settings\edward.millis\Documents\MyFaves.htm",
>> _
>> FileFormat:=wdFormatHTML
>>
>> This macro was written in Word XP, which has now been upgraded to
>> 2007. The OS has also been updated from WinXP Pro to Vista Pro.
>>
>> When I run the macro in Word only, it runs fine - the file is
>> generated and saved to the correct folder in the correct format.
>>
>> I want to email the file out, so I am trying to run it from within an
>> Outlook 2007 macro. (Security settings prevent Word VBA from
>> accessing OL VBA, or I would do it all from within Word.)
>>
>> The OL macro creates the Word instance just fine and runs the macro
>> just fine - until it hits the SaveAs. I put a STOP in the Word code
>> just before the SaveAs to verify this - as soon aas I F8 to the
>> SaveAs, my error handler tells me that Outlook VBA has the following
>> error:
>> -2147417851
>> Method "Run" of object "Application" failed
>>
>> Any suggestions on getting this macro to run when accessed from OL
>> VBA?
>> Ed
>