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
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: