[VBA ] 沒有設定物件變數或with 區塊變數
請教大家
我在VBA 寫了一個物件類別模組名為newclass
內容是
' new class
public str1 as string
public sub msg()
msgbox str1
end sub
然後到模組內去產生這個物件
sub testclass()
dim msg1 as newclass
msg1.str1="aaaaa"
msg1.msg
end sub
我是照著書做的,可是在msg1.str1="aaaaa"這一行就出錯了
錯誤訊息就是沒有設定物件變數或with區塊
請問這個問題是什麼?我應該要怎麼解決?
我只想試試看class module用法結果一開始就出錯了..
謝謝大家
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.56.194.52
推
10/03 10:20, , 1F
10/03 10:20, 1F
推
10/03 10:39, , 2F
10/03 10:39, 2F
推
10/03 20:24, , 3F
10/03 20:24, 3F
推
10/03 20:24, , 4F
10/03 20:24, 4F
→
10/03 20:25, , 5F
10/03 20:25, 5F