+ Reply to Thread
Results 1 to 6 of 6

Very easy problem : Referencing to a GetOpenFilename sheet

  1. #1
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Very easy problem : Referencing to a GetOpenFilename sheet

    Hi guys,

    I'm having problems with the following code:
    Please Login or Register  to view this content.
    Seems I'm too newb to use a reference to a workbook that was opened with the GetOpenFilename Command :/ Whats the probelm here? I want to chose which file to open and then use a reference to that file (wB) to open/copy etc.

    I get the open new file window, but whatever i select i get a Run-time error '424': Object Required

    Thanks!
    Last edited by Bishonen; 03-23-2012 at 07:03 AM.

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Very easy problem : Referencing to a GetOpenFilename sheet

    It should be Workbooks, not Workbook.

    But I wouldn't do it all in the one line like that. What if the user cancels, you cannot trap that as the code is.

  3. #3
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: Very easy problem : Referencing to a GetOpenFilename sheet

    Please Login or Register  to view this content.
    This code seems to be partially working now. I get the desired file open but excel stops at Range("B:B").delete

    anyone got a clue how to make it delete the row "B"? It worked until I've changed stuff further into the code ><

  4. #4
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Very easy problem : Referencing to a GetOpenFilename sheet

    You need to qualify it with the workbook object variable, and the worksheet. I would also just use Columns("B").

    I see you ignored my comment about cancelling the GetOpenFilename.

  5. #5
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: Very easy problem : Referencing to a GetOpenFilename sheet

    To be honest with you Bob, it was your advice that returned the error in the first place :/ I got my file working now.

    Please Login or Register  to view this content.
    Cheers!

  6. #6
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Very easy problem : Referencing to a GetOpenFilename sheet

    Quote Originally Posted by Bishonen View Post
    To be honest with you Bob, it was your advice that returned the error in the first place
    I don't think so. You posted because you had an error, nothing to do with me. My correction of that error just showed up more problems in your code.

+ 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