vb中怎样使用相对路径 (App.path)
我以前用VB编过一个修改当前目录Word文件扩展名的程序,其中用到了相对路径(App.path),希望对你有所帮助,程序很容易看懂的。如果有问题,可以HI我:)
以下是程序代码:)
Private Sub Command1_Click()
'Exit
Unload Me
End Sub
Private Sub Command2_Click()
'Decode Word Format
Dim WrdApp As Object
Dim String_Out As String
String_Out = Form1.Text1
Dim WrdDoc As Object
If (Form1.Text1 <> "") And (Form1.Text2 <> "") And Dir(App.Path & "\" & String_Out & ".doc") <> "" Then
Set WrdApp = CreateObject("Word.Application")
Set WrdDoc = WrdApp.Documents.Open(App.Path & "\" & String_Out & ".doc", , False)
WrdApp.Visible = False
String_Out = Form1.Text2
WrdDoc.SaveAs App.Path & "\" & String_Out & ".aaa"
WrdDoc.Save
WrdDoc.Close
WrdApp.Quit
Set WrdDoc = Nothing
Set WrdApp = Nothing
Name App.Path & "\" & String_Out & ".aaa" As App.Path & "\" & String_Out & ".doc"
End If
End Sub
2011-04-01
App.path是你这个正在运行的程序的路劲 只到文件夹