mikeb at mitre.org
Tue Sep 3 16:00:16 EDT 2002
That was great, but most importantly, it was FAST!
Would it be possible to tell how you did that so quickly? Is there a reference that would tell me that x1LastCell is in constants? or that you put the activeWindow in front of ActiveCell?
Do you know of any references as to how to do it in Microsoft Project whose object model seems much less documented than Excel's is?
I know how to use Project Explorer in the Visual Basic Editor inside the Microsoft OLE applications like Microsoft Project, and I know how to get the Python list of objects using makepy. However, that does not seem to be enough to figure out many questions in Microsoft Project (and even some questions in Microsoft Excel).
What would be really nice is a document that explains what each object in the list is used for. For example, when opening a Microsoft Project file, it asks a bunch of questions like: are macros okay? should I open related files? should I save the changes I think you made to the previous file?
I would like to learn how to cancel out those messages when I open a Microsoft Project file from Python. What book or application do you recommend I purchase? Or what file can I download to learn how to do these things?
>I would like to emulate this Visual Basic statement from Python, using
> Range(Range("A1"), ActiveCell.SpecialCells(xlLastCell)).Select
>this statement selects the active worksheet (which is, incidentally,
>not similar to UsedRange).
from win32com.client import Dispatch
from win32com.client import constants
xl = Dispatch("Excel.Application")
AB = xl.ActiveWorkbook
AS = AB.ActiveSheet
AW = xl.ActiveWindow
R = AS.Range('A1',AW.ActiveCell.SpecialCells(constants.xlLastCell))
print AB.Name, AS.Name, R
More information about the Python-list