回复 2楼 ZHRXJR
建议不错
Dim F7 As String, nStr7 As String, nSize7 As Long, S7 As Long
F7 = App.Path & "\config.ini"
nSize7 = 255: nStr7 = String(nSize7, 0)
d7 = GetPrivateProfileString("Form2", "CLpart", vbNullString, nStr7, nSize7, F7)
S7 = InStr(nStr7, Chr(0))
If S7 > 0 Then
nStr7 = Left(nStr7, S7 - 1) 'nStr7在这里提取的字符串是 “ App.Path & "\材质库.sldmat"”
End If
boolstatus = swApp.SetUserPreferenceStringValue(swUserPreferenceStringValue_e.swFileLocationsMaterialDatabases, nStr7) '这里nStr7 还是认为了相对路径的字符串,没有变成绝对路径的字符串。
改了一下变成
Label1.Caption=nStr7
boolstatus = swApp.SetUserPreferenceStringValue(swUserPreferenceStringValue_e.swFileLocationsMaterialDatabases, Label1.Caption) ’OK!!