Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Passing variables from Outlook Macro to Excel Macro

I have a macro in Outlook 2003 that starts up Excel 2003 and loads a
workbook. I want to then, from Outlook call a Excel macro and send it
some variables. I followed the application.Run example in the help but
I still recieve a Runtime Error: 424 Object required.
Does anyone know what I am doing wrong in passing the variables?

'Outlook Macro
Sub StartExcel()
Dim xlApp As Object
Set xlApp = CreateObject("excel.application")
xlApp.Visible = True
a = "Test Text"
Set EBook = xlApp.workbooks.Add("C:\temp\book1.xls")
mySum = AxlApp.Run("book1.xls!macro1", a)

xlApp.Quit
Set xlApp = Nothing
End Sub


'Macro in Excel
Sub Macro1(a As String)
MsgBox a
End Sub

THanks
Scott

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Passing variables from Outlook Macro to Excel Macro

Scott,

If you are just creating the workbook, how can it have a macro in it?

--

HTH

RP
(remove nothere from the email address if mailing direct)


wrote in message
oups.com...
I have a macro in Outlook 2003 that starts up Excel 2003 and loads a
workbook. I want to then, from Outlook call a Excel macro and send it
some variables. I followed the application.Run example in the help but
I still recieve a Runtime Error: 424 Object required.
Does anyone know what I am doing wrong in passing the variables?

'Outlook Macro
Sub StartExcel()
Dim xlApp As Object
Set xlApp = CreateObject("excel.application")
xlApp.Visible = True
a = "Test Text"
Set EBook = xlApp.workbooks.Add("C:\temp\book1.xls")
mySum = AxlApp.Run("book1.xls!macro1", a)

xlApp.Quit
Set xlApp = Nothing
End Sub


'Macro in Excel
Sub Macro1(a As String)
MsgBox a
End Sub

THanks
Scott



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Passing variables from Outlook Macro to Excel Macro

The workbook I am opening already has the macro in it. I fixed my
problem it was how I was sending the variables.
ExcelApp.Run Macroname:="macro2", varg1:=A

Scott



Bob Phillips wrote:
Scott,

If you are just creating the workbook, how can it have a macro in

it?

--

HTH

RP
(remove nothere from the email address if mailing direct)


wrote in message
oups.com...
I have a macro in Outlook 2003 that starts up Excel 2003 and loads

a
workbook. I want to then, from Outlook call a Excel macro and send

it
some variables. I followed the application.Run example in the help

but
I still recieve a Runtime Error: 424 Object required.
Does anyone know what I am doing wrong in passing the variables?

'Outlook Macro
Sub StartExcel()
Dim xlApp As Object
Set xlApp = CreateObject("excel.application")
xlApp.Visible = True
a = "Test Text"
Set EBook = xlApp.workbooks.Add("C:\temp\book1.xls")
mySum = AxlApp.Run("book1.xls!macro1", a)

xlApp.Quit
Set xlApp = Nothing
End Sub


'Macro in Excel
Sub Macro1(a As String)
MsgBox a
End Sub

THanks
Scott


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing variables between a form and macro David New Users to Excel 1 October 5th 05 04:42 AM
Passing variables between a form and macro David New Users to Excel 4 September 23rd 05 11:57 AM
passing arguments from an excel macro to a word macro KWE39 Excel Discussion (Misc queries) 1 July 7th 05 03:56 PM
passing variables from an excel macro to a powerpoint macro jake Excel Programming 1 December 11th 03 02:36 AM
passing variables from excel to word Mike NG Excel Programming 8 July 22nd 03 12:08 PM


All times are GMT +1. The time now is 04:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"