LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
Type Mismatch Error David Excel Discussion (Misc queries) 2 December 11th 05 04:46 PM
Why type mismatch - R/T error 13 Jim May Excel Discussion (Misc queries) 5 January 9th 05 06:45 PM
Type Mismatch error Grant Excel Programming 6 September 1st 04 11:12 PM
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error rdavis7408 Excel Programming 1 August 25th 04 03:54 AM


All times are GMT +1. The time now is 02:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"