Thread: win32com

    #1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    206
    Rep Power
    11

    win32com


    Hi all,

    does anybody know how to paste something in the clipboard into an excelsheet?
    I tried the following code:
    Code:
    xlApp = win32com.client.dynamic.Dispatch('Excel.Application')
    xlBook = xlApp.Workbooks.Open("C:/test.xls")
    xlSheet = xlBook.Worksheets("Test")
    xlSheet.Range(sht.Cells(1, 1), sht.Cells(1, 1)).Activate()
    xlSheet.Paste(1, 1)
    xlBook.Save()
    My problem is that i don't know how to use the Paste method.
    Any ideas?
  2. #2
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Two books you might be interested in if your working with COM are "Python Programming" and "Python Programming on Win32". You can read about & order both from Amazon.com. You might also wana look at the the Python cookbook too see if there is any sample code..

    http://aspn.activestate.com/ASPN/Python/Cookbook/
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    206
    Rep Power
    11
    I have these two books :-)
    ... but it doesn't help at all
  6. #4
  7. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Wow's ok dude, don't know what your doing but it must be pretty complex. The book "Python Programming on Win32" has quite alot of entries referancing COM in it's index..

    http://www.oreilly.com/catalog/pythonwin32/inx.html#C

    other than that i'd check out comp.lang.python..

    http://groups.google.com/groups?group=comp.lang.python

    Sorry i couldn't be more help.
    Mark.
  8. #5
  9. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Hey wiz, found this COM tutorial on google..

    http://www.python.org/windows/win32com/COMTutorial/

    Have fun,
    Mark.

IMN logo majestic logo threadwatch logo seochat tools logo