+ Reply to Thread
Results 1 to 11 of 11

Error message with application get open filename

  1. #1
    Forum Contributor
    Join Date
    09-06-2011
    Location
    northern ireland
    MS-Off Ver
    Excel 365
    Posts
    180

    Error message with application get open filename

    Please Login or Register  to view this content.
    I have been using this code - but it doesn't like "If WeeklyFN = False Then"

    A message box appears when the user does not select a file but when the user selects the applicable file for the macro a run time error 13 appears, Type mismatch ?

    Can anyone help me with this - if so thank you in advance
    Last edited by leanne2011; 12-21-2011 at 06:38 AM.

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

    Re: Error message with application get open filename

    Change it to
    Please Login or Register  to view this content.
    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]

  3. #3
    Forum Contributor
    Join Date
    09-06-2011
    Location
    northern ireland
    MS-Off Ver
    Excel 365
    Posts
    180

    Re: Error message with application get open filename

    Hi Arlu

    I tried that - but a message comes back to say I selected false - it works fine if the user selects a file but if they press cancel - then this is where my troubles begin

    thanks a lot
    Leanne

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

    Re: Error message with application get open filename

    Yes, let me help you understand the code. First, it asks the user to select the file. If the user doesnt select anything, it gives the error msg and prompts the user to open the file again. It will keep prompting the user until they open a file. If you do not want that to happen, you can change the code to this:
    Please Login or Register  to view this content.
    This will come out of the macro completely if the user does not select anything.

  5. #5
    Forum Contributor
    Join Date
    09-06-2011
    Location
    northern ireland
    MS-Off Ver
    Excel 365
    Posts
    180

    Re: Error message with application get open filename

    Thanks Arlette - I will give that a go and ta for explaining the code.

    One more thing if you could help me with I would be very appreciative - you helped me before with the code to open the filename, when I select the file, even when I am finished the whole macro the file selected at the start remains open.

    What code would I use to close that particular workbook. I tried activeworkbook.close, weeklyfn.close etc but no matter what I try it remains open.

    Please Login or Register  to view this content.

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

    Re: Error message with application get open filename

    Try
    Please Login or Register  to view this content.

  7. #7
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Error message with application get open filename

    Please Login or Register  to view this content.
    Last edited by snb; 12-20-2011 at 02:06 PM.



  8. #8
    Forum Contributor
    Join Date
    09-06-2011
    Location
    northern ireland
    MS-Off Ver
    Excel 365
    Posts
    180

    Re: Error message with application get open filename

    Quote Originally Posted by leanne2011 View Post
    Thanks Arlette - I will give that a go and ta for explaining the code.

    One more thing if you could help me with I would be very appreciative - you helped me before with the code to open the filename, when I select the file, even when I am finished the whole macro the file selected at the start remains open.

    What code would I use to close that particular workbook. I tried activeworkbook.close, weeklyfn.close etc but no matter what I try it remains open.

    Please Login or Register  to view this content.
    hi Arlette- this still does not work for me. It works if the user presses cancel, the user is forced to exit out of the macro. But when the user selects the file they are presented with a run time error 13 - Type Mismatch ? Any ideas

    And the Workbooks(WeekFN).close worked perfectly - thanks for that
    Kind regards
    Leanne

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

    Re: Error message with application get open filename

    Try this: (I had given it to you in post 4 but i guess you didnt see it.
    Please Login or Register  to view this content.
    Now it shouldnt give you any error.

  10. #10
    Forum Contributor
    Join Date
    09-06-2011
    Location
    northern ireland
    MS-Off Ver
    Excel 365
    Posts
    180

    Re: Error message with application get open filename

    Hi Arlette

    I saw post 4 and your most recent - they both give an error message 13 - type mismatch. As I said - works fine if the user presses cancel - but when the user trys to select the file they are presented with the error message

    thanks
    leanne

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

    Re: Error message with application get open filename

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

+ 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