Application.Run not working

L

Lokutus

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(xlEdgeLeft).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
 
C

Chip Pearson

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" <[email protected]>
wrote in message
news:[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top