+ Reply to Thread
Results 1 to 3 of 3

"400" error when running macro

  1. #1
    Registered User
    Join Date
    06-14-2010
    Location
    reading, pa
    MS-Off Ver
    Excel 2003
    Posts
    2

    "400" error when running macro

    I've been fooling around with vba lately and have run into an error i cant quite figure out. Basically i have a workbook with a bunch of sheets and im using vba to insert data and such. I have a piece of code that i wanted to use to open another excel file and copy/paste the data into my big workbook. Now, the code works FINE when i run it from a form. I have a button on my form, "insert data", push it, it opens the excel document, copies and pastes the data into my workbook, then closes the excel document. But, when i use that same code on the sheet in the workbook and just run the macro i get an error and a popup that just says "400".

    when i use the debug feature and step into the macro it fails on the "range" line and gives me a run-time error 1004. code is below.

    Please Login or Register  to view this content.
    Like i said, when i run this code from a form on my workbook it runs perfectly. when i put it in the sheet though (which is the dsc sheet) i get an error... and it's the same code. Any ideas?? Obviously the code is fine, it works. So why would i get an error when putting it on a sheet compared to running it on a form??

    Jason

    ps - i want to eliminate using a form, why im asking. i only had a form built for testing purposes. this is just a piece of a project im working on, want to tie it into some other things.
    Last edited by jasonp; 06-14-2010 at 04:01 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: "400" error when running macro

    Welcome to the forum.

    Please take a few minutes to read the forum rules, and then edit your post to add CODE tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    06-14-2010
    Location
    reading, pa
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: "400" error when running macro

    I'll do one "bump" on this and then throw in the towel. I assumed it was something simple, a small oversight or maybe even a glitch in excel.

    Again, the code above WORKS when used in a form. The form opens on startup, i hit my button, code executes and inserts my data beautifully. BUT, when i run this code from my macro menu (the code is in the sheet) It crashes. The other excel sheet will open, but it will crash before it even selects the data to copy. Seems really weird.

+ 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