投稿日 | : 2005/06/30(Thu) 16:58 |
投稿者 | : N.K.J |
Eメール | : |
URL | : |
タイトル | : エクセルのタスク終了について |
初めまして
VB6でエクセルに書き込み作業をする作業です。
作成時はエクセルのタスクは終了していたのですが、別のパソコンに
配布したり、エクセルファイルをサーバー側において操作した場合、
タスクが消えなくなりました。いろいろプログラムを変更したり試して
みたのですが解りませんでした。教えて頂けないでしょうか。
[環境] エクセル2000,WINDOWS2000
[ソース]
Private Sub FileDb()
Dim myRow As Long
Dim xlapp2 As Excel.Application
Dim xlbook2 As Excel.Workbook
Dim xlsheet2 As Excel.Worksheet
On Error GoTo dbg:
Set xlapp2 = CreateObject("Excel.Application")
xlapp2.Visible = False
xlapp2.DisplayAlerts = False
Set xlbook2 = xlapp2.Workbooks.Open(MyPath & "\MYDB.xls")
Set xlsheet2 = xlbook2.Worksheets("data_base")
If xlbook2.ReadOnly = True Then
xlbook2.Close savechanges:=False
xlapp2.Quit
Set xlsheet2 = Nothing
Set xlbook2 = Nothing
Set xlapp2 = Nothing
Else
With xlsheet2
myRow = .Cells(65536, 1).End(xlUp).Row + 1
.Cells(myRow, 1).Value = Date
End With
xlsheet2.SaveAs (MyPath & "\MYDB.xls")
MsgBox "完了"
IDMLst.Enabled = False
End If
xlapp2.Visible = True
xlapp2.Quit
Set xlsheet2 = Nothing
Set xlbook2 = Nothing
Set xlapp2 = Nothing
Exit Sub
dbg:
MsgBox Err.Description
If xlapp2.Visible = False Then
xlapp2.Quit
End If
End Sub
宜しくお願いします。