+ Reply to Thread
Results 1 to 6 of 6

Runtime Error 13 .... Type Mismatch

Hybrid View

mawnek Runtime Error 13 .... Type... 10-26-2016, 09:00 AM
Kyle123 Re: Runtime Error 13 ....... 10-26-2016, 09:03 AM
mawnek Re: Runtime Error 13 ....... 10-28-2016, 09:27 AM
Kyle123 Re: Runtime Error 13 ....... 10-28-2016, 09:36 AM
mawnek Re: Runtime Error 13 ....... 11-02-2016, 11:41 AM
Kyle123 Re: Runtime Error 13 ....... 11-03-2016, 02:03 PM
  1. #1
    Registered User
    Join Date
    06-30-2014
    Location
    DFW AREA
    MS-Off Ver
    2003 & 2007
    Posts
    3

    Runtime Error 13 .... Type Mismatch

    Sub BEQUOTE()

    'Step 1 Copy the data
    Sheets("QUOTE").Range("A2:H60").Select
    Selection.Copy
    'Step 2 Open BE QUOTE FORM
    Workbooks.Open Filename:="\\NETWORK\shared\PRICING PROGRAMS\Bucket Elevator\BE QUOTE FORM.xls"
    'Step 3 Paste the data
    ActiveSheet.Paste Destination:=Range("A1")
    Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats
    'Step 4 Define Path Names and File Name
    Dim SaveName1 As String
    ‘Year, i.e. 2016’
    Dim SaveName2 As String
    ‘Month, i.e. K-OCT’
    Dim SaveName3 As String
    ‘Quote Number, i.e. X123456-XX’
    Dim SaveName4 As String
    ‘Customer Name, i.e. ABC Co.”
    SaveName1 = ActiveSheet.Range("C1").Text
    ‘Evaluates as 2016’
    SaveName2 = ActiveSheet.Range("C2").Text
    ‘Fails to Evaluate’
    SaveName3 = ActiveSheet.Range("F7").Text
    ‘Evaluates as X123456-XX’
    SaveName4 = ActiveSheet.Range("B9").Text
    ‘Evaluates as ABC Co.’
    'Step 5 Turn off application alerts
    Application.DisplayAlerts = False
    'Step 6 Save the newly created workbook
    ActiveWorkbook.SaveAs _
    Filename:="\\NETWORK\shared\QUOTES\Bucket Elevator\" & SaveName1 \ " & SaveName2\" & SaveName3 & " " & SaveName4 & ".xls"
    'Step 7 Turn application alerts back on
    Application.DisplayAlerts = True
    Application.CutCopyMode = False
    ActiveWindow.ActiveCell.Select
    End Sub
    Last edited by mawnek; 10-26-2016 at 09:42 AM.

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Runtime Error 13 .... Type Mismatch

    You're missing some ampersands here:
    "\\NETWORK\shared\QUOTES\Bucket Elevator\" & SaveName1 \ " & SaveName2\" & SaveName3 & " " & SaveName4 & ".xls"
    Also, please use code tags:
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE] [/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

  3. #3
    Registered User
    Join Date
    06-30-2014
    Location
    DFW AREA
    MS-Off Ver
    2003 & 2007
    Posts
    3

    Re: Runtime Error 13 .... Type Mismatch

    The Run Time error 13....Type Mismatch occurs in Step 6 and the SaveName2 string fails to evaluate. All of the other SaveName strings evaluate as intended. Is it possible that I have something incorrect in the Filename format?

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Runtime Error 13 .... Type Mismatch

    Yes, as I've said you're missing an ampersand

  5. #5
    Registered User
    Join Date
    06-30-2014
    Location
    DFW AREA
    MS-Off Ver
    2003 & 2007
    Posts
    3

    Re: Runtime Error 13 .... Type Mismatch

    I have altered Step 6 code as follows:
    [code]ActiveWorkbook.SaveAs _
    Filename:="\\NETWORK\shared\QUOTES\Bucket Elevator\" & SaveName1 \ "" & SaveName2 \ "" & SaveName3 & " " & SaveName4 & ".xls"[code]
    All of the SaveName components evaluate properly, but I still get a Runtime Error 13 .... Type Mismatch at the end, seemingly associated with the .xls" portion. Any suggestions?

  6. #6
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Runtime Error 13 .... Type Mismatch

    Yes, as I've said, you're still missing an ampersand:
    "\\NETWORK\shared\QUOTES\Bucket Elevator\" & SaveName1 & "\" & SaveName2 & "\" & SaveName3 & " " & SaveName4 & ".xls"

+ 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. Type Mismatch Runtime Error 13
    By EXCELBENCH in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 04-21-2015, 05:06 PM
  2. Runtime error'13' - type mismatch
    By Polluz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-24-2014, 01:12 PM
  3. RunTime Error 13: Type MIsmatch
    By tariq2 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-24-2013, 10:47 AM
  4. [SOLVED] Runtime Error '13' Type Mismatch
    By Rayneill in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-08-2013, 01:03 AM
  5. [SOLVED] runtime error 13 type mismatch
    By chappie in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-30-2012, 10:12 PM
  6. RunTime Error 13 and Type Mismatch...
    By TheNewGuy in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-24-2010, 09:24 AM
  7. runtime error 13 type mismatch
    By D_Rennie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-15-2009, 11:15 PM

Tags for this Thread

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