+ Reply to Thread
Results 1 to 3 of 3

Application.Run not working

  1. #1
    Registered User
    Join Date
    03-08-2006
    Posts
    2

    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(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

  2. #2
    GS
    Guest

    RE: Application.Run not working

    Should be:

    result = FinishExport

    Regards,
    GS

  3. #3
    Chip Pearson
    Guest

    Re: 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" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > 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
    >
    >
    > --
    > Lokutus
    > ------------------------------------------------------------------------
    > Lokutus's Profile:
    > http://www.excelforum.com/member.php...o&userid=32270
    > View this thread:
    > http://www.excelforum.com/showthread...hreadid=520498
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1