PC Review


Reply
Thread Tools Rate Thread

Calling Excel macro from Access errors

 
 
=?Utf-8?B?U25vd3NyaWRl?=
Guest
Posts: n/a
 
      2nd Nov 2006
Hi

I'm calling an Excel macro from Access and get an error

440 Method 'Run' of object '_Application' failed

I've cut and pasted the offending piece of code into a separate procedure:

Sub Test()

ActiveWorkbook.SaveAs Filename:= _
"C:\Apps\Reward and Recognition\Quarterly reports\" _
& "Quarterly KPIs.xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False

ActiveWorkbook.Close SaveChanges:=False

End Sub

Help appreciated.

 
Reply With Quote
 
 
 
 
NickHK
Guest
Posts: n/a
 
      3rd Nov 2006
How are you calling this from Access ?

NickHK

"Snowsride" <(E-Mail Removed)> wrote in message
news:496409B1-0D13-4B08-9F57-(E-Mail Removed)...
> Hi
>
> I'm calling an Excel macro from Access and get an error
>
> 440 Method 'Run' of object '_Application' failed
>
> I've cut and pasted the offending piece of code into a separate procedure:
>
> Sub Test()
>
> ActiveWorkbook.SaveAs Filename:= _
> "C:\Apps\Reward and Recognition\Quarterly reports\" _
> & "Quarterly KPIs.xls", FileFormat:=xlNormal, _
> Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
> CreateBackup:=False
>
> ActiveWorkbook.Close SaveChanges:=False
>
> End Sub
>
> Help appreciated.
>



 
Reply With Quote
 
=?Utf-8?B?U25vd3NyaWRl?=
Guest
Posts: n/a
 
      3rd Nov 2006
Dim objExcel As Excel.Application

Set objExcel = Excel.Application
With objExcel
..Visible = True
Workbooks.Open("C:\Apps\Reward and Recognition\" _
& "Quarterly reports\Template.xls").Activate

..Run "Test"

End With
---------------------------

Access opens Template.xls OK and runs other code in the Test macro but it
fails when it tries to save Template.xls under another name.




"NickHK" wrote:

> How are you calling this from Access ?
>
> NickHK
>
> "Snowsride" <(E-Mail Removed)> wrote in message
> news:496409B1-0D13-4B08-9F57-(E-Mail Removed)...
> > Hi
> >
> > I'm calling an Excel macro from Access and get an error
> >
> > 440 Method 'Run' of object '_Application' failed
> >
> > I've cut and pasted the offending piece of code into a separate procedure:
> >
> > Sub Test()
> >
> > ActiveWorkbook.SaveAs Filename:= _
> > "C:\Apps\Reward and Recognition\Quarterly reports\" _
> > & "Quarterly KPIs.xls", FileFormat:=xlNormal, _
> > Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
> > CreateBackup:=False
> >
> > ActiveWorkbook.Close SaveChanges:=False
> >
> > End Sub
> >
> > Help appreciated.
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling Access Macro via .asp paulmitchell507 Microsoft Access 5 23rd Jul 2008 04:10 PM
Calling a macro in excel Rodney Crow Microsoft Excel Programming 1 5th Feb 2008 02:42 AM
calling excel macro from C# =?Utf-8?B?Vmlua2k=?= Microsoft ASP .NET 1 30th Oct 2007 07:44 AM
Calling an Excel macro from VB.NET cr113@hotmail.com Microsoft VB .NET 2 8th Sep 2005 08:51 PM
Excel macro run in Access errors Kristof Microsoft Access Macros 1 26th Nov 2003 03:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:15 PM.