본문 바로가기

VBA

[VBA] byref 인수 형식이 일치하지 않습니다



1. 함수에 들어가는 인수의 형식이 맞지 않는다.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Dim testvalue as Integer
Function TestFunc( arg As StringAs Boolean
 
'.................
end Function
 
 
 
 
TestFunc(testvalue) 'error
 
 
 
 
 
cs




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Dim testvalue as String
Function TestFunc( arg As StringAs Boolean
 
'.................
end Function
 
 
 
 
TestFunc(TestValue) 
 
 
 
 
 
cs




2. 함수에 들어가는 인수의 형식을 선언하지 않았다



1
2
3
4
5
6
7
8
9
10
Dim testvalue1, testvalue2 as String 'testvalue1 is Variant type
Function TestFunc( arg As StringAs Boolean
 
'.................
end Function
 
 
 
 
TestFunc(TestValue1) 'err
cs


1
2
3
4
5
6
7
8
9
10
Dim testvalue1 as String, testvalue2 as String 
Function TestFunc( arg As StringAs Boolean
 
'.................
end Function
 
 
 
 
TestFunc(TestValue1)
cs

'VBA' 카테고리의 다른 글

[VBA] Short-Circuit은 지원하지 않는다.  (0) 2018.01.31