The way to do it (by cheating) is to open Excel and record a macro in which
you select the cells and then justify them. Then open the VBA Editor in Excel
and copy the code over to Access.
Are you able to open the Excel spreadsheet using VBA? The macro will give
you the code to select & format, but you'll need additional code to actually
open up the file.
Hi ambushsinger,
for example to center (or right align) the content of cells J1 to K2
Set ExcelSheet = CreateObject("Excel.Sheet")
ExcelSheet.Application.Range("J1:K2").Select
With ExcelSheet.Application.Selection
.HorizontalAlignment = xlCenter ''to center horizontally
.HorizontalAlignment = xlRight ''to right align
.VerticalAlignment = xlCenter ''to center vertically
Hi ambushsinger,
for example to center (or right align) the content of cells J1 to K2
Set ExcelSheet = CreateObject("Excel.Sheet")
ExcelSheet.Application.Range("J1:K2").Select
With ExcelSheet.Application.Selection
.HorizontalAlignment = xlCenter ''to center horizontally
.HorizontalAlignment = xlRight ''to right align
.VerticalAlignment = xlCenter ''to center vertically
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.