Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Application.Run not working


Hi,
I need to call one macro from another macro.
There is function like this:

Public Function FinishExport() As String
With Sheets(1)
Range("K3", "K" +
CStr(Sheets("DEF").Range("A2"))).Borders(xlEdgeLef t).LineStyle =
xlContinuous
End With
FinishExport = "TEST"
End Function

and I need to call this function like this:

Public Sub getResult()
Dim result
result = Application.Run("FinishExport")
MsgBox (result)
End Sub

But it is not working. An error 400 allways occures.
Any idea? Thanks in advance. Lokutus


--
Lokutus
------------------------------------------------------------------------
Lokutus's Profile: http://www.excelforum.com/member.php...o&userid=32270
View this thread: http://www.excelforum.com/showthread...hreadid=520498

  #2   Report Post  
Posted to microsoft.public.excel.programming
GS GS is offline
external usenet poster
 
Posts: 364
Default Application.Run not working

Should be:

result = FinishExport

Regards,
GS
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Application.Run not working

You don't use Application.Run to run a macro in the same
workbook. Instead, just type the macro's name.

Public Sub getResult()
Dim result
result = FinishExport
MsgBox result
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Lokutus"
wrote in message
...

Hi,
I need to call one macro from another macro.
There is function like this:

Public Function FinishExport() As String
With Sheets(1)
Range("K3", "K" +
CStr(Sheets("DEF").Range("A2"))).Borders(xlEdgeLef t).LineStyle
=
xlContinuous
End With
FinishExport = "TEST"
End Function

and I need to call this function like this:

Public Sub getResult()
Dim result
result = Application.Run("FinishExport")
MsgBox (result)
End Sub

But it is not working. An error 400 allways occures.
Any idea? Thanks in advance. Lokutus


--
Lokutus
------------------------------------------------------------------------
Lokutus's Profile:
http://www.excelforum.com/member.php...o&userid=32270
View this thread:
http://www.excelforum.com/showthread...hreadid=520498



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
Working with XL and another not related application Excelfan Excel Discussion (Misc queries) 6 December 21st 08 02:45 AM
Working with application path Nirmal Singh[_2_] Excel Programming 3 December 15th 05 09:59 AM
Application.FileSearch is not working?? alondon Excel Programming 5 January 18th 05 03:12 AM
Application.Displayalerts = value (is not working for me) [email protected] Excel Programming 3 December 18th 04 02:00 AM
application displayalert not working? Will Lam Excel Programming 2 May 3rd 04 05:16 PM


All times are GMT +1. The time now is 03:05 PM.

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"