?
Solved

creating excel page on the fly

Posted on 2003-03-18
5
Medium Priority
?
248 Views
Last Modified: 2012-05-04
Hi,
   I'm creating excel page on the fly within asp page.  I got one problem on the verticalalignment line.  This work fine in VB but does an error in ASP.  Any idea?

Set oExcel = server.createobject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
Set oSheet = oBook.Worksheets(1)

oSheet.Range("a1") = "Imprimé le :"
osheet.range("b1") = tofrenchdatelong(now)
oSheet.Range("a3") = "Demande"
oSheet.Range("b3") = "Trv"

oSheet.Range("a3:i4").VerticalAlignment = xlVAlignCenter

Daniel
0
Comment
Question by:DanielBlais
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
magic_pie earned 500 total points
ID: 8160590
Daniel,

Have you declared the constant xlVAlignCenter anywhere?  If not this will be the problem as in vb when you reference the Excel object (as I'm guessing you do) it automatically references the constants but is ASP it doesn't.

Add the following line to start of the ASP and give it another go:

Const xlVAlignCenter = -4108

magic_pie
0
 
LVL 2

Author Comment

by:DanielBlais
ID: 8160768
i'm so stupid.
0
 
LVL 2

Author Comment

by:DanielBlais
ID: 8160895
ok, I have another question.  May be you can help me.

I want to change the orientation.

In vb, it works.  In ASP, I got this error :

const xlPortrait = 1
const xlLandscape = 2
oSheet.PageSetup.Orientation = xlLandscape

"Impossible de définir la propriété Orientation de la classe PageSetup."

I saw somewhere that this properties is readonly.  But it works in VB.
0
 
LVL 1

Expert Comment

by:magic_pie
ID: 8165600
I've tried that myself and it appears to work fine.  

The only thing I can suggest is you make sure you haven't made a mistake anywhere like closed the workbook or anything before trying to set the property.

Also, you might want to try reading the property value as a test that it can be accessed ok.
0
 
LVL 2

Author Comment

by:DanielBlais
ID: 8176004
I have tried to read the properties and it doesn't work.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question