[python-win32] Excel Paste Special Error

Tim Roberts timr at probo.com
Mon Jul 28 23:45:06 CEST 2014


Qing Xu wrote:
> Hi All
>
> Original code:
>
> import win32com.client
> import win32clipboard
> from win32com.client import Dispatch
>
> ws_fc_ipn.PasteSpecial(Paste=-4163)

It would be better to use the symbolic names, like
win32com.client.constants.xlPasteValues.  Or:
    from win32com.client import constants
    ws_fc_ipn.PasteSpecial(constants.xlPasteValues)


> Wanted copy and paste special (paste value) to selection. Gave me
>
> "Type Error: PasteSpecial() got an unexpected keyword argument 'Paste' "
>
> If anyone knows where the mistake is that would be great!

Named parameters should work, although you can always fall back to
positional parameters, like what I have above.  What version of Python
and Python-Win32 are you using?

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20140728/e593c1ee/attachment.html>


More information about the python-win32 mailing list