Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 8 of 8

Thread: Open a file and start macro from macro in another file

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Posts
    64
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I am trying to have a macro in a particular file open another file and have it start a macro in that file. I can get it to open the file, but not get the macro to start. I have used RunAutoMacros w/ xlAutoOpen, but I either get errors or no macro running after the file opens.

  2. #2
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-03-21 21:17, Fryer Tuck wrote:
    I am trying to have a macro in a particular file open another file and have it start a macro in that file. I can get it to open the file, but not get the macro to start. I have used RunAutoMacros w/ xlAutoOpen, but I either get errors or no macro running after the file opens.

    Try [untested]

    Application.Run "'Theworkbook.xls'!MacroName"


    Ivan

  3. #3
    Board Regular
    Join Date
    Mar 2002
    Posts
    64
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Still getting error 438:
    Object doesn't support this property or method.
    Any other ideas

  4. #4
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-03-21 23:02, Fryer Tuck wrote:
    Still getting error 438:
    Object doesn't support this property or method.
    Any other ideas
    What code are you using ?

  5. #5
    Board Regular
    Join Date
    Mar 2002
    Posts
    64
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Using VBA in Excel 2000
    In response to a command button on a form, the following code is executed:

    Workbooks.Open (FileName:=Path and file, Password:= password to open).Activate

    Application.Run "'workbook.xls'!macro"

    I tried this with "RunAutoMacos xlAutoOpen" in place of the "Activate", but still didn't get anywhere.

  6. #6
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-03-21 23:47, Fryer Tuck wrote:
    Using VBA in Excel 2000
    In response to a command button on a form, the following code is executed:

    Workbooks.Open (FileName:=Path and file, Password:= password to open).Activate

    Application.Run "'workbook.xls'!macro"

    I tried this with "RunAutoMacos xlAutoOpen" in place of the "Activate", but still didn't get anywhere.
    This worked for me;

    Private Sub CommandButton1_Click()
    Workbooks.Open Filename:="C:ExcelFilesUsefulVBA Get GUID.xls", password:="test"
    Application.Run "'VBA Get GUID.xls'!MoreReferenceWork"
    End Sub


    Ivan

    check your coding ??


  7. #7
    Board Regular
    Join Date
    Mar 2002
    Posts
    64
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Could there be some switch in Excel that is blocking this? I am still getting the Run-time error 438"Object doesn't support this property or method"

  8. #8
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi Fryer


    If you are using the Auto_open (check out Workbook_open) you will need the "RunAutoMacros" Method

    Workbooks.Open (FileName:=Path and file, Password:= password to open)
    ActiveWorkbook.RunAutoMacros

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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