python - Adding an Excel Textbox with win32com -


i trying add excel textbox worksheet... typical shortcut use in excel gui alt+n x , click want textbox; however, don't have access com browser, leaves me guessing microsoft hid textbox api under python's win32com...

from win32com import client  excel=client.dispatch("excel.application") excel.visible=true book=excel.workbooks.open("c:/users/dpennington/desktop/blank.xls", false,      true) sheet=book.worksheets(2) 

how add textbox (i.e. in excel gui: alt+n x), using python's win32com api? (specific positioning in worksheet you...)

use addtextbox method of shapes object:

import win32com.client client  xl = client.dispatch("excel.application") xl.visible = true wb = xl.workbooks.open("c:/1temp/badacres.xls") ws = wb.sheets(1)  tb = ws.shapes.addtextbox(1, 570, 45, 171, 80) tb.textframe2.textrange.characters.text = 'this great big test.' 

you can find more on addtextbox method here.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -