+ Reply to Thread
Results 1 to 7 of 7

Problems with opening a file from Excel VBA

  1. #1
    Registered User
    Join Date
    04-03-2012
    Location
    Stockholm
    MS-Off Ver
    Excel 2003
    Posts
    33

    Problems with opening a file from Excel VBA

    Hi,

    I have a problem when I try to open a new Excel workbook with a VBA macro. I have the followin gcode

    ***********************************************
    Please Login or Register  to view this content.
    ****************************************************

    It opens the selected file but then it starts the sub routine all over again without moving the data.

    Any ideas?

    Best Regards
    Stefan
    Last edited by arlu1201; 08-14-2012 at 04:21 AM.

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Problems with opening a file from Excel VBA

    there's no code to move anything but I can't see a loop there other than with the filedialog. a lot of the code is fairly pointless though as you can just use
    Please Login or Register  to view this content.
    btw if you write
    Please Login or Register  to view this content.
    this_Workbook is actually declared as a variant not as a workbook
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    04-03-2012
    Location
    Stockholm
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: Problems with opening a file from Excel VBA

    Hi,
    I have code to move the data but did not include it. When I use Debug mode and Step In the code stops after executing the Open file row and starts all over again. It is weird.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Problems with opening a file from Excel VBA

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. If you need more information on how to use them, check my signature.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  5. #5
    Registered User
    Join Date
    04-03-2012
    Location
    Stockholm
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: Problems with opening a file from Excel VBA

    Okay.

    I got it to work with Joseph's help. Thanks....

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Problems with opening a file from Excel VBA

    Ok, its great that your issue is solved.

    Please mark your thread as solved - Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Problems with opening a file from Excel VBA

    do you have any code in the workbook you are opening? (especially in the workbook_open or workbook_activate events)

+ 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