chichaspowa
New Member
- Joined
- Sep 6, 2010
- Messages
- 46
Hey guys wondering if u can help me out on a piece of code here.
The idea is saving 2 spreadsheets of my workbook to another file with the same spreadsheets. Whenever i run the code it gives me the 1004 pastespecial method error. Gonna paste the code so you can see.
Thanks for your help in advance.
The idea is saving 2 spreadsheets of my workbook to another file with the same spreadsheets. Whenever i run the code it gives me the 1004 pastespecial method error. Gonna paste the code so you can see.
Thanks for your help in advance.
Code:
Private Sub actserv_Click()
Dim wbk As Workbook
Application.ScreenUpdating = False
strsecondfile = "C:\Documents and Settings\Utilizador\Os meus documentos\program\armz servidor.xlsm"
With Sheets("Stock")
.Cells.Copy
End With
Set wbk = Workbooks.Open(strsecondfile)
With wbk.Sheets("Stock")
.Cells.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
wbk.Save
wbk.Close
End With
With Sheets("Registos")
.Cells.Copy
End With
Set wbk = Workbooks.Open(strsecondfile)
With wbk.Sheets("Registos")
.Cells.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
wbk.Save
wbk.Close
End With
Application.ScreenUpdating = True
MsgBox ("Actualizado com êxito")
End Sub