+ Reply to Thread
Results 1 to 2 of 2

can't address sub in other workbook

Hybrid View

  1. #1
    Registered User
    Join Date
    09-14-2009
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2007
    Posts
    4

    Exclamation can't address sub in other workbook

    Hi my name is Ronald and I'm a junior programmer. What I'm trying to do is when I click a button in workbook1 it starts a certain sub. In that sub, the application is supposed to copy a certain file, rename it, and open it. After that it has to call a sub of that new file with some parameters.

    The problem is the following: Copying, renaming and opening the file is not a problem. But when I try to call the sub, the application gives the errormessage "400". I really don't know what the problem is, so if anyone has any idea, please tell me.

    I'm using the following code:

    filenameOriginal = ThisWorkbook.Path & "\invoice.xlsm"
        filename = "invoice " & client & "  " & Format(Now, "dd_mm_yyyy") & ".xlsm"
        filenameNew = ThisWorkbook.Path & "\" & filename
        
        'copy and open template
        FileCopy filenameOriginal, filenameNew
        Workbooks.Open (filenameNew)
        
        Application.Run "'" & filename & "'!fillInvoice", gegevens

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: can't address sub in other workbook

    How have you code the routine FillInvoice?

    The principle should work.
    Cheers
    Andy
    www.andypope.info

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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