![]() |
Type mismatch error
Hallo,
I have the problem with numeric input via inputbox used in file path. E.g. … \Rok 2004 (GFS 1986 data)\SR\SR 2004 Q data.xls (numeric parameter in this sample is "2004", respectively). These are my 2 routines (for second I tried the workaround posted in groups), but neither of them is working. Thanks a lot in advance for any suggestions. Best regards, Petr Duzbaba Sub test_mismatch_error1() Dim SegmInput As String Dim YearInput As Integer Application.ScreenUpdating = False Do: SegmInput = InputBox("Submit the correct abbreviation (SR)!") If Not SegmInput = "SR" Then MsgBox "Invalid input (must be SR)!", vbCritical End If Loop Until SegmInput = "SR" segment_dbvr = SegmInput Do: YearInput = InputBox("Submit year!") If Not YearInput = 2004 Then MsgBox " Invalid input (must be 2004)!", vbCritical End If Loop Until YearInput = 2004 year_dbvr = YearInput Workbooks.Open Filename:= _ "C:\Dokumenty\Prace\Verejne rozpocty\Ostatni VR\DB VR\Ctvrtletni data\Rok " & year_dbvr & " (GFS 1986 data)" \ " & segment_dbvr & " \ segment_dbvr & " " & year_dbvr & " Q data.xls""" End Sub Sub test_mismatch_error2() Dim segment_dbvr As String Application.ScreenUpdating = False Do: SegmInput = Application.InputBox("Submit correct abbrev. (SR)") If Not SegmInput = "SR" Then MsgBox "Invalid input (must be SR)!", vbCritical End If Loop Until SegmInput = "SR" Dim year_dbvr As Integer Dim year_dbvr_aux As String year_dbvr_aux = InputBox("Submit year:", "Year input") If IsNumeric(year_dbvr_aux) Then year_dbvr = year_dbvr_aux Workbooks.Open Filename:= _ "C:\Dokumenty\Prace\Verejne rozpocty\Ostatni VR\DB VR\Ctvrtletni data\Rok " & year_dbvr & " (GFS 1986 data)" \ " & segment_dbvr & " \ segment_dbvr & " " & year_dbvr & " Q data.xls""" Else End If End Sub |
Type mismatch error
What is this supposed to do:
" Q data.xls""" It would produce Q data.xls" Why do you query the user for information you already know? just want to smack'em around a little? -- Regards, Tom Ogilvy "Petr" wrote in message om... Hallo, I have the problem with numeric input via inputbox used in file path. E.g. . \Rok 2004 (GFS 1986 data)\SR\SR 2004 Q data.xls (numeric parameter in this sample is "2004", respectively). These are my 2 routines (for second I tried the workaround posted in groups), but neither of them is working. Thanks a lot in advance for any suggestions. Best regards, Petr Duzbaba Sub test_mismatch_error1() Dim SegmInput As String Dim YearInput As Integer Application.ScreenUpdating = False Do: SegmInput = InputBox("Submit the correct abbreviation (SR)!") If Not SegmInput = "SR" Then MsgBox "Invalid input (must be SR)!", vbCritical End If Loop Until SegmInput = "SR" segment_dbvr = SegmInput Do: YearInput = InputBox("Submit year!") If Not YearInput = 2004 Then MsgBox " Invalid input (must be 2004)!", vbCritical End If Loop Until YearInput = 2004 year_dbvr = YearInput Workbooks.Open Filename:= _ "C:\Dokumenty\Prace\Verejne rozpocty\Ostatni VR\DB VR\Ctvrtletni data\Rok " & year_dbvr & " (GFS 1986 data)" \ " & segment_dbvr & " \ segment_dbvr & " " & year_dbvr & " Q data.xls""" End Sub Sub test_mismatch_error2() Dim segment_dbvr As String Application.ScreenUpdating = False Do: SegmInput = Application.InputBox("Submit correct abbrev. (SR)") If Not SegmInput = "SR" Then MsgBox "Invalid input (must be SR)!", vbCritical End If Loop Until SegmInput = "SR" Dim year_dbvr As Integer Dim year_dbvr_aux As String year_dbvr_aux = InputBox("Submit year:", "Year input") If IsNumeric(year_dbvr_aux) Then year_dbvr = year_dbvr_aux Workbooks.Open Filename:= _ "C:\Dokumenty\Prace\Verejne rozpocty\Ostatni VR\DB VR\Ctvrtletni data\Rok " & year_dbvr & " (GFS 1986 data)" \ " & segment_dbvr & " \ segment_dbvr & " " & year_dbvr & " Q data.xls""" Else End If End Sub |
Type mismatch error
Dear Tom,
you are right that the double "" at the end of " Q data.xls""" could be omitted, be sure that I am trying to help myself and use the past users experiences from groups as much as possible, but even if I remove the "" at the end the runtime error type mismatch error is still occuring. Best regards, Petr Duzbaba "Tom Ogilvy" wrote in message ... What is this supposed to do: " Q data.xls""" It would produce Q data.xls" Why do you query the user for information you already know? just want to smack'em around a little? -- Regards, Tom Ogilvy "Petr" wrote in message om... Hallo, I have the problem with numeric input via inputbox used in file path. E.g. . \Rok 2004 (GFS 1986 data)\SR\SR 2004 Q data.xls (numeric parameter in this sample is "2004", respectively). These are my 2 routines (for second I tried the workaround posted in groups), but neither of them is working. Thanks a lot in advance for any suggestions. Best regards, Petr Duzbaba Sub test_mismatch_error1() Dim SegmInput As String Dim YearInput As Integer Application.ScreenUpdating = False Do: SegmInput = InputBox("Submit the correct abbreviation (SR)!") If Not SegmInput = "SR" Then MsgBox "Invalid input (must be SR)!", vbCritical End If Loop Until SegmInput = "SR" segment_dbvr = SegmInput Do: YearInput = InputBox("Submit year!") If Not YearInput = 2004 Then MsgBox " Invalid input (must be 2004)!", vbCritical End If Loop Until YearInput = 2004 year_dbvr = YearInput Workbooks.Open Filename:= _ "C:\Dokumenty\Prace\Verejne rozpocty\Ostatni VR\DB VR\Ctvrtletni data\Rok " & year_dbvr & " (GFS 1986 data)" \ " & segment_dbvr & " \ segment_dbvr & " " & year_dbvr & " Q data.xls""" End Sub Sub test_mismatch_error2() Dim segment_dbvr As String Application.ScreenUpdating = False Do: SegmInput = Application.InputBox("Submit correct abbrev. (SR)") If Not SegmInput = "SR" Then MsgBox "Invalid input (must be SR)!", vbCritical End If Loop Until SegmInput = "SR" Dim year_dbvr As Integer Dim year_dbvr_aux As String year_dbvr_aux = InputBox("Submit year:", "Year input") If IsNumeric(year_dbvr_aux) Then year_dbvr = year_dbvr_aux Workbooks.Open Filename:= _ "C:\Dokumenty\Prace\Verejne rozpocty\Ostatni VR\DB VR\Ctvrtletni data\Rok " & year_dbvr & " (GFS 1986 data)" \ " & segment_dbvr & " \ segment_dbvr & " " & year_dbvr & " Q data.xls""" Else End If End Sub |
All times are GMT +1. The time now is 04:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com