View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.newusers
JLatham JLatham is offline
external usenet poster
 
Posts: 2,203
Default VBA copy cell to another worksheet

It works properly for me under several tests. So we need to focus in on what
part of the command is not working properly.

Set up some test code and see if it works:

Sub TestFileOpen()
Workbooks.Open("\\srv01\Dp\ANTONELLA\sblocco.xls")
End Sub

If that does not work properly, check to be certain that the path to the
file is correct.

If that does work, then change the code and test again:
Sub TestFileOpen()
Workbooks.Open("\\srv01\Dp\ANTONELLA\sblocco.xls", False, False)
End Sub

And if that also works properly, test a little mo
Sub TestFileOpen()
Dim strNomeFile As String

strNomeFile = "\\srv01\Dp\ANTONELLA\sblocco.xls"
Workbooks.Open(strNomeFile, False, False)
End Sub

and once more, if that succeeds, move on to another test
Sub TestFileOpen()
Dim objWorkbook As Workbook
Dim strNomeFile As String

strNomeFile = "\\srv01\Dp\ANTONELLA\sblocco.xls"
Workbooks.Open(strNomeFile, False, False)
Set objWorkbook = Workbooks(ActiveWorkbook.Name)
ThisWorkbook.Activate
End Sub


"franco monte" wrote:

Thanks JLatham, it's exactly that I want!
But on the line -- Set objWorkbook = Workbooks.Open(strNomeFile,
False, False)
I have the same error:
Errore di run-time '1004'.
Errore definito dall'applicazione o dall'oggetto.
I'm searching for on the net but Your help is appreciated!
Thanks again
.