Last week I posted in VB Questions, then I thought I solved, but I didn't!!
Here comes the code:
''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub Command1_Click()

Dim xlApp As Object
Dim myPath As String
Dim myFile1 As String
Dim myFile2 As String
Dim myWorkbook As String
Set xlApp = CreateObject("Excel.Application")
myPath = App.Path
myWorkbook = myPath & "\" & myFile1
With xlApp
.Visible = False
.Workbooks.Open myWorkbook, 3
.ActiveWorkbook.Unprotect "myCode"
.myWorkbook = myPath & "\" & myFile2
.Workbooks.Open myWorkbook, 3
.Workbooks(myFile).Activate
.Worksheets(mySheet).Select
.Worksheets(mySheet).Unprotect "myCode"

.Worksheets(mySheet).Copy After:=Workbooks(myFile1).Worksheets(2)

.Workbooks.Application.CutCopyMode = False
.Workbooks(myFile2).Close False
.ActiveWorkbook.Protect "myCode", True
End With
xlApp.Visible = True
Set xlApp = Nothing
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''
This is an automatic copy what I want my program to do every time I start Excel.
If I now continuing working in Excel while my VB project is still running and than quit Excel and I want to enter again then I get the Runtime Error 462 about a remote machine.
It give this error only because of the sheet copy line!!
Who can help me????