+ Reply to Thread
Results 1 to 10 of 10

Error Message Visual Basic 400 - help!

  1. #1
    Registered User
    Join Date
    04-15-2009
    Location
    So. Cal
    MS-Off Ver
    Excel 2003
    Posts
    11

    Error Message Visual Basic 400 - help!

    I have attached sample files of what I am running. Please forgive me if my lingo is off but what I am trying to accomplish is I have an Excel template of a packing slip called Factory Master Packing Slip and it has an Import button. Once the import button is press it brings up a Import File box. You then select the file to import.. and this case it will be the Shipping Slip 2 file attached. It should take the data from form 1 to form 2. I have run this macro on other forms with luck but not with this one. Can the pros take a look at this and tell me what i am doing wrong. Maybe a setting?

    Should state that I am getting the "400" error when running...
    Attached Files Attached Files
    Last edited by EarlD; 06-04-2009 at 02:58 AM.

  2. #2
    Registered User
    Join Date
    03-31-2004
    Location
    Toronto, Canada
    MS-Off Ver
    2003/2007
    Posts
    36

    Re: Error Message Visual Basic 400 - help!

    Hi,
    the problem is when you select your range before copying. I am not too sure why since I never do it this way.
    try replacing the following part of your code
    Please Login or Register  to view this content.
    instead of the entire copy paste part of your code try something like below

    Please Login or Register  to view this content.
    hope it works for you!

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Error Message Visual Basic 400 - help!

    Hello EarlD,

    I partially rewrote your macro and tested it. This will copy the information over from the imported workbook to the template.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Registered User
    Join Date
    04-15-2009
    Location
    So. Cal
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Error Message Visual Basic 400 - help!

    Leith,

    Here are the errors I get when using your code. Please see attachment. I really appreciate all your help.

    Earl
    Attached Files Attached Files
    Last edited by EarlD; 06-04-2009 at 01:59 AM.

  5. #5
    Registered User
    Join Date
    04-15-2009
    Location
    So. Cal
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Error Message Visual Basic 400 - help!

    Keyur,

    I get the same error on your solution. It must be something I just am over looking. I attached the updated file in case you see something I don't. Thank You
    Attached Files Attached Files
    Last edited by EarlD; 06-04-2009 at 01:45 AM.

  6. #6
    Registered User
    Join Date
    04-15-2009
    Location
    So. Cal
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Error Message Visual Basic 400 - help!

    Here is my Code..

    Please Login or Register  to view this content.

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Error Message Visual Basic 400 - help!

    Hello EarlD,

    Here are you original files with the macro I added.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    04-15-2009
    Location
    So. Cal
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Error Message Visual Basic 400 - help!

    Leith,

    I ran the macro and the first thing I get is this (attached) error. I click ok and it goes to my form and everything is populated correctly but it completely deletes the code from VB. So I have to close and reopen. ??? Please see attachment. I feel it is sooo close...
    Attached Images Attached Images

  9. #9
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Error Message Visual Basic 400 - help!

    Hello EarlD,

    If you read the comments I inserted into your code, you will find the section that deletes all the macro code from the workbook. It appears you weren't aware that this section of code did that. You can simply delete that section and all the macro code will remain intact. When you copy code, if there is part of it you don't understand then ask someone to explain it.

    Delete these line from the macro
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    04-15-2009
    Location
    So. Cal
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Error Message Visual Basic 400 - help!

    Quote Originally Posted by Leith Ross View Post
    Hello EarlD,

    If you read the comments I inserted into your code, you will find the section that deletes all the macro code from the workbook. It appears you weren't aware that this section of code did that. You can simply delete that section and all the macro code will remain intact. When you copy code, if there is part of it you don't understand then ask someone to explain it.

    Delete these line from the macro
    Please Login or Register  to view this content.
    Leith,

    You are the MAN!! You are right! Its getting late and I didn't even see that down there. It works absolutely perfect now!! Thank You Leith and Thank You excelforum.com!!!

+ 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