ユーザー定義関数について
ユーザー定義関数について
VBA初心者です。画像1は正常、画像2に変更したときに空白レコードに#エラーが出るようになってしまいました。変更点は、ByVal gと(1)削除したのですが、どのような式を入れれば良いのでしょうか。宜しくお願い致します。
画像1: (正常です)
link(T_photo!photo1,T_photo!folder1,T_photo!folder2,T_photo!folder3,T_photo!year,T_tag!domain,T_photo!folder4)
Public Function link _
(ByVal a, ByVal b, ByVal c, ByVal d, ByVal e, ByVal f As String, ByVal g) As String
link = IIf(Trim("" & a) = "", "", _
(1) IIf(Trim("" & b & c & d & e & a) = "", "", "" & f) & _
IIf(Trim("" & b) = "", "", "" & b & "/") & _
IIf(Trim("" & c) = "", "", "" & c & "/") & _
IIf(Trim("" & d) = "", "", "" & d & "/") & _
IIf(Trim("" & e) = "", "", "" & e & "-link/") & _
IIf(Trim("" & a) = "", "", "" & g & "-" & a))
画像2: (#エラー)
link_ec(T_photo!photo1,T_photo!folder1,T_photo!folder2,T_photo!folder3,T_photo!year,T_photo!folder4)
Public Function link_ec _
(ByVal a, ByVal b, ByVal c, ByVal d, ByVal e, ByVal f As String) As String
link_ec = IIf(Trim("" & a) = "", "", _
IIf(Trim("" & b) = "", "", "" & b & "/") & _
IIf(Trim("" & c) = "", "", "" & c & "/") & _
IIf(Trim("" & d) = "", "", "" & d & "/") & _
IIf(Trim("" & e) = "", "", "" & e & "-link/") & _
IIf(Trim("" & a) = "", "", "" & f & "-" & a))
お礼
URLまで付けてくださってありがとうございます。