我正在尝试将价目表从一个工作簿更新到另一个工作簿,但我不想向客户发送主价目表中的宏...
Master 最终将为每个供应商提供一个选项卡。
主副本将在没有宏的情况下发送给客户。
这是我现在的代码..
我不断收到错误 1004 粘贴方法失败
'Now copy from the Update Master to the Cust Master...
mWrk = "A1:Z" & Trim(Str(TotRows)) <---TotRows is the total # of rows used
Application.CutCopyMode = XLCopy
Worksheets(WhichFile).Range(mWrk).Copy <-- WhichFile has the value of the sheet name..
Dim mXLCopy As Workbook
Set mXLCopy = Workbooks.Open(ThisWorkbook.Path & "\Customer Master Price.xlsx")
' See if the sheet is already there. if so delete it.
Dim IsThere As Boolean
IsThere = False
For x = 1 To mXLCopy.Sheets.Count
If UCase(mXLCopy.Sheets(x).Name) = UCase(WhichFile) Then
IsThere = True
End If
Next x
Application.DisplayAlerts = False
If IsThere Then
mXLCopy.Sheets(WhichFile).Delete
End If
'
'Now add it & activate it..
mXLCopy.Sheets.Add().Name = WhichFile
mXLCopy.Activate
With mXLCopy.Sheets(WhichFile)
Range(mWrk).PasteSpecial xlPasteAll, xlPasteSpecialOperationNone <- Fails here
End With
Application.DisplayAlerts = True
mXLCopy.Save
mXLCopy.Close
Set mRange = Nothing
Set mXLCopy = Nothing
有什么想法吗?如果必须的话,请继续取笑我,但是我需要一个答案,而我的一个都没有工作...