Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How can I align excel cell from vb?

Posted on 1999-07-08
3
Medium Priority
?
215 Views
Last Modified: 2012-06-27
How can I align excel cell from vb?
0
Comment
Question by:itacan
[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
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
vindevogel earned 400 total points
ID: 1523012
This example opens Excel, adds a value in a cell and aligns it to the right

Cut and paste this code in the click event of a command button to test it ...

You also have vbAlignLeft and vbAlignCenter



    Dim vExcel As Excel.Application
    Dim vSheet As Worksheet
   
    Set vExcel = New Excel.Application
    vExcel.Visible = True
   
    vExcel.Workbooks.Add
    Set vSheet = vExcel.ActiveWorkbook.Sheets("Sheet1")
   
    vSheet.Cells(1, 1) = "Yves"
    vSheet.Range("A1", "A1").HorizontalAlignment = vbAlignRight
   
    Set vSheet = Nothing
    Set vExcel = Nothing

0
 

Author Comment

by:itacan
ID: 1523013
Thank you
0
 
LVL 4

Expert Comment

by:vindevogel
ID: 1523014
welcome
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

661 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