help with runtime error 13 mismatch

dodgeking3171

New Member
Joined
Feb 6, 2014
Messages
39
Hey guys I have the following code, the highlighted line seems to give me a runtime error 13 mismatch. i had a few others that i could figure out but this one has me stumped.

the part that is giving me the trouble right now is . Workbooks.Open Left(Path, Len(Path) - 5) & FileName

also, can someone explain what the causes the runtime error? ive never had ths problem before

thanks guys the whole code is longer, but this leads up to the problem im having right now

Code:
Private Sub Workbook_Open()





Dim printquotes As String


Dim OrigDate As Date


letmesave = True






OrigDate = ActiveSheet.Range("n2").Value








If CDate(Now) > CDate(OrigDate) + 23 Then


MsgBox " This application is about to expire, please renew"


End If
If CDate(Now) > CDate(OrigDate) + 25 Then


MsgBox " PAY ATTENTION TO THE NEXT PROMPT"




printquotes = MsgBox("This application has expired.  Would you like to print all quotes?" _
& vbNewLine & "all quotes will be saved on the desktop under expired quotes" _
& vbNewLine & "NOTE ALL QUOTES WILL BE CLEANED", vbYesNo, Expired)


MkDir "C:\Users\PARTS1\Desktop\Expired Quotes"
If printquotes = vbYes Then GoTo line2:
If printquotes = vbNo Then GoTo line3:
End If


      'Prints all sheets
                                                    
line2:
                                                    Dim wb As Workbook, ws As Worksheet
                                                    Dim FileName As String, Path As String
                                                    Dim skip As String
      
     
    
                                                    Set wb = ActiveWorkbook
                                                    Set ws = ActiveSheet


                                                   Path = "\\BIG-BERTHA-PC\Data\Customer Estimate Folder\Quotes\*.xls"
   
                                                   FileName = Dir(Path, vbNormal)
                                                   Application.DisplayAlerts = False
                                                   Do Until FileName = ""
                                                   [COLOR=#ff0000]Workbooks.Open Left(Path, Len(Path) - 5) & FileName[/COLOR]
0                                                 Set wb = ActiveWorkbook
                                                    For Each ws In wb.Worksheets
            
          
                                                    skip = ws.Range("k4")
        
                                                    If IsEmpty(skip) Then GoTo line1:
        
                                                    If skip = "0" Then GoTo line1:
                                                     
                                                    If Not (skip) = "" Then
      
                                                    ws.PrintOut
    
line1:
                                                    End If
  
                                                  Next
    
                                                   wb.Close
    
                                                    FileName = Dir()
                                                   Loop
                                                    Application.DisplayAlerts = True
                                                 


line3:
[\code]
 
Last edited:

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Sorry guys i dont seem to know how to do the tag option
Forward slash not backslash or select your code and click the # button.
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top