I have a simple paste special macro assigned to a button image…
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
So a user can copy data from an outside source and then select a cell in the workbook that will be compiled with padlock, click the macro button and the data is pasted in. It functions perfectly in the workbook before compiling, but after compiling it throws…
Error 1004: PasteSpecial method of range class failed
What setting would be causing the error after compiling?
Which version of XLS Padlock are you using? And what is the outside source app?
Using the current 2019 version and copying data from another Excel spreadsheet or text file.
Copying from either source paste fine using the macro in the workbook before compiling.
If I copy data within the compiled workbook and then use the pastespecial macro it works fine, so it’s only not working when copying data from an outside source.
Is the compiled workbook not seeing the copied data or treating the clipboard as being empty for some reason?
Found a solution… this macro allows you to manually copy any data from any outside source, Word, Excel, etc. and click a button (with macro assigned to it) to paste into any cell in the compiled workbook.
Tested using Excel 2013… if anyone uses it in a workbook compiled in different Excel version please post if it works ok or not.
On Error GoTo ErrorHandler
If Application.ClipboardFormats(1) <> -1 Then
If Application.CutCopyMode Then
'Paste values, if in CutCopyMode
Application.CutCopyMode = False
'Paste text, if from external source
'Error will be caught, if there is nothing to paste