473,503 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

excel application

Hello here is the code:

from win32com.client import Dispatch
packing = Dispatch("Excel.Application")
packing.Visible = 1
packing.Workbooks.Add()
#packing.Worksheets.Add()
packing.ActiveSheet.Range("A1").ColumnWidth = 8
packing.ActiveSheet.Range("B1").ColumnWidth = 12
packing.ActiveSheet.Range("C1").ColumnWidth = 6
packing.ActiveSheet.Range("D1").ColumnWidth = 6
packing.ActiveSheet.Range("E1").ColumnWidth = 6
packing.ActiveSheet.Range("F1").ColumnWidth = 60
packing.ActiveSheet.Range("G1").ColumnWidth = 13
packing.ActiveSheet.Range("H1").ColumnWidth = 10
packing.ActiveSheet.Range("A8:H9").Select()
packing.ActiveSheet.Selection.Borders(xlDiagonalDo wn).LineStyle
= xlNone

The error messege is

global name xlNone is not definied

what I have mistaken?

Regards

Luca

Mar 29 '06 #1
4 1572
Hi Luca,

The words xlDiagonalDown e xlNone are Excel constants and don't are in
the Local NameSpace

use these values:
xlNone = -4142
xlDiagonalDown = 5

Then the last line stay like that
"""
packing.ActiveSheet.Selection.Borders(5).LineStyle = -4142
# Excel Constants: xlNone = -4142 xlDiagonalDown = 5
"""

When use the integer values in your code remeber to comment the
significant of these values, to a future corrections :)

[],

Luciano Pacheco

Mar 29 '06 #2
Thanks a lot Luciano

Regards Luca

Mar 29 '06 #3
Luca,
you can find a lot of answers to your questions on this discussion
group. If you will try to search using key words "excel constants" for
example, you will get the link to the following link (among others):
http://tinyurl.com/go3qf

IMHO it is good idea to search the web and discussion groups before
posting questions (I am not saying it is a bad idea to ask here, I am
only trying to show an simple alternative how to get an answers to your
questions to you)

HTH
Regards
Petr Jakes

Mar 29 '06 #4
Thanks Peter

Regards

Luca

Mar 30 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6372
by: Lize | last post by:
Hi, I'm writing an ASP application to open an excel workbook, then run a macro stored in the excel file, which produces outputs that will be displayed back onto my ASP application. Now the...
3
20271
by: Otie | last post by:
I found the following under the GetObject help notes and in the example for GetObject: "This example uses the GetObject function to get a reference to a specific Microsoft Excel worksheet...
6
12468
by: Matthew Wieder | last post by:
I have the following requirements: Build a stand-alone C# application that asks the user to click in a cell in an Excel spreadsheet, and then displays the address of that cell in the C#...
1
3015
by: Bernd Muent | last post by:
Hi together, I am using the following code in Visual Basic to open Word or Excel applications: Word: Dim w As Word.Application w = CType(CreateObject("Word.application"), Word.Application)...
14
5733
by: pmud | last post by:
Hi, I need to use an Excel Sheet in ASP.NET application so that the users can enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever the USER ENETRS needs to go to the...
22
15312
by: Howard Kaikow | last post by:
There's a significant problem in automating Excel from VB .NET. Reminds me of a problem I encountered almost 3 years ago that was caused by the Norton Auntie Virus Office plug-in. Can anybody...
9
2806
by: Anthony | last post by:
To me, creating Excel 2003 spreadsheets programmatically via VB.NET hasn't really changed since the days of VB6. That is, I'd do something similar to this Code: Dim ExcelApp As...
2
2783
by: iloveprincess | last post by:
Hi, I'm developing windows application using VB.Net 2005. I would like to send 'save' message using 'SendMessage' API to the excel appication. I've already got a handle of the excel window with...
9
4518
by: Doug Glancy | last post by:
I got the following code from Francesco Balena's site, for disposing of Com objects: Sub SetNothing(Of T)(ByRef obj As T) ' Dispose of the object if possible If obj IsNot Nothing AndAlso...
0
7201
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7083
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7278
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6988
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3166
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1510
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
379
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.