[python-win32] Registering an excel addin

Tim Roberts timr at probo.com
Fri Apr 13 19:20:20 CEST 2007


mjohnson wrote:
> Apologies if this is in an incorrect format, but I have just stumbled
> on the list whilst trying to solve my problem
>
> from win32com.client import Dispatch
> xlApp = Dispatch("Excel.Application")
> time.sleep(40)
> xlApp.Visible = 1
> wb=xlApp.Workbooks.Add()
> xlApp.RegisterXLL("C:\Program Files\TestApp\Program\EXLXL32.XLL")
>
> the register step returns false and does not register EXLXL32.XLL.

Yes, Mark is exactly right.  The "\T" in your file name is actually a
"tab" character, rather than the two characters you think it is.  You
have three choices:
1. Double the backslashes:  "C:\\Program
Files\\TestApp\\Program\\EXLXL32.XLL"
2. Use the "r" syntax: r"C:\Program Files\TestApp\Program\EXLXL32.XLL"
3. Use forward slashes:  "C:/Program Files/TestApp/Program/EXLXL32.XLL"

Any of them will work.  Choose the one that makes the most sense to you.

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



More information about the Python-win32 mailing list