标题:变量怎么代入
只看楼主
lujin13925
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-3-11
 问题点数:0 回复次数:2 
变量怎么代入
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Private Sub Command1_Click()
Dim A As Long
Dim B
B = "c:\aa"
A = WritePrivateProfileString("TIP", "START", B, App.Path & "\ABC.INI")
If A = 0 Then MsgBox ("写文件时出错")
End Sub


运行时提示类型不匹配,这里的变量B没办法代入,哪位老大帮改下啊
搜索更多相关主题的帖子: 代入 变量 ByVal String Sub 
2008-03-01 12:09
永夜的极光
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:2721
专家分:1
注 册:2007-10-9
得分:0 
把声明改成这样试试
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As string, ByVal lpFileName As String) As Long

从BFS(Breadth First Study)到DFS(Depth First Study)
2008-03-01 18:51
lujin13925
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-3-11
得分:0 
谢谢斑竹啊,OK了
2008-03-01 19:40



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-201519-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018170 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved