+ Reply to Thread
Results 1 to 6 of 6

Using the GetOpenFileName method to import sheets after activesheet

  1. #1
    Forum Contributor
    Join Date
    05-30-2013
    Location
    France
    MS-Off Ver
    2010
    Posts
    260

    Using the GetOpenFileName method to import sheets after activesheet

    Hi,

    I'm trying to use the GetOpenFileName method to import sheets.

    Please Login or Register  to view this content.
    I'm getting two errors:
    1)
    Please Login or Register  to view this content.
    I Get a Type MisMatch Error whenever I select a file
    2)
    Please Login or Register  to view this content.
    Also get a Type MisMatch Error...

    Any ideas ?

    Thanks!
    amphi
    Last edited by amphinomos; 05-27-2014 at 05:38 AM.

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: Using the GetOpenFileName method to import sheets after activesheet

    You could try to modify the code so:
    Please Login or Register  to view this content.
    Regards,
    Antonio

  3. #3
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Using the GetOpenFileName method to import sheets after activesheet

    You're looping through the array of Workbooks but not referencing which workbook in the array you want to open..

    Change this:
    Please Login or Register  to view this content.
    to this..

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    05-30-2013
    Location
    France
    MS-Off Ver
    2010
    Posts
    260

    Re: Using the GetOpenFileName method to import sheets after activesheet

    Thanks Antonio. That definitely does make the code neater but I still get a Type MisMatch Error on the
    Please Login or Register  to view this content.
    line...

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Using the GetOpenFileName method to import sheets after activesheet

    Try this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  6. #6
    Forum Contributor
    Join Date
    05-30-2013
    Location
    France
    MS-Off Ver
    2010
    Posts
    260

    Re: Using the GetOpenFileName method to import sheets after activesheet

    Thanks apo & Norie. Now I'm getting a "To hide, delete, or move the selected sheet(s), you must first insert a new sheet or unhide a sheet that is already hidden." The first sheet on the file I'm importing exists and is visible...

    Edit: Switched the Move After to Copy After (the file I was importing from only had one worksheet which couldn't be moved) . Solved !
    Last edited by amphinomos; 05-27-2014 at 08:21 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Excel 2011 Macro error "Method 'GetOpenFilename" of object'_Application'failed
    By rfox69 in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 1
    Last Post: 09-26-2012, 08:35 AM
  2. Help with implementing GetOpenFileName dialog box in Data Import
    By DarkDevin in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-24-2011, 10:44 AM
  3. Location method with ActiveSheet
    By pierre_colin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-30-2010, 07:51 AM
  4. GetOpenFileName method different in Excel
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-15-2005, 04:06 AM
  5. Replies: 3
    Last Post: 03-25-2005, 04:06 PM

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