Solved

VB.Net, Office, #$%^&@ Constants

Posted on 2004-04-20
3
1,151 Views
Last Modified: 2012-06-22
Where do I get a listing of what the values are for Excel and Word constants that were perfectly legitimate (or at least some were) in VB 6 but seemed to have disappeared off the face of the planet for VB.NET

For example

   
    With objWS.Range("A1:M1")
        .HorizontalAlignment = xlLeft
        .VerticalAlignment = xlBottom
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = True
    End With

I need to find values for xlLeft, xlCenter, xlRight, xlBottom, xlContext, ad. nausum.

Thanks,
K
0
Comment
Question by:Knomaze
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
malharone earned 250 total points
ID: 10872369
you've to explicitely refer to them using the Excel namespace.

eg.

worksheet.Range("A1:M1").VerticalAlignment = Excel.Constants.xlBottom
0
 
LVL 9

Expert Comment

by:malharone
ID: 10872406
if you can't find the enum/constant in Excel.Constants namespace,
the easiest way to locate them is go to Excel, Tools > Macros > VB Editor.
In the VBA, press F2 (or view > object browser) and enter the name of the constant and search for it. it'll list LIBRARY and CLASS columns. Use them as a namespace.
0
 

Author Comment

by:Knomaze
ID: 10872686
I was about to update the question that I FINALLY found the name space in the object browser with all the constants declared but then needed to know how I referenced it. This is exactly what I was looking for.

Thank-you,
K
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

680 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