19545 Formatting Excel from Access
Sign Up |  Live StatsLive Stats    Articles 37,332| Comments 177,286| Members 19,416, Newest Kaylee| Online 537
Home Contact
 (Forgotten?): 
    Sikhism
    For best SPN experience, use Firefox Internet Browser!


                                                                   Your Banner Here!    




Click Here to Register/Sign Up Daily Hukamnama Member Blogs Downloads Website Navigation Help Fonts Tags

Formatting Excel from Access

Our Donation Goal : Why Donate? : Donate Today! : Donate Anonymously (ਗੁਪਤ) : Our Family of Supporters
Goal this month: 500 USD, Received: 115 USD (23%)
Please Donate...
     
Related Topics...
Thread Thread Starter Forum Replies Last Post
Keep Formatting - Access to Excel hank755_ca@yahoo.ca Information Technology 3 28-Jul-2006 08:35 AM
Formatting Time in Access Shemot3467 Information Technology 1 28-Jul-2006 08:26 AM
Excel To Access Wills Information Technology 2 28-Jul-2006 08:25 AM
Excel and Access Mike Information Technology 2 28-Jul-2006 08:21 AM
Text formatting (bold, etc) part of field entry in Access Isaac Information Technology 1 28-Jul-2006 08:18 AM


Tags
formatting, excel, access
Reply Post New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!
  #1 (permalink)  
Old 01-Nov-2005, 13:40 PM
danijela.simunovic@gmail.com's Avatar danijela.simunovic@gmail.com
Guest
 
Posts: n/a
   
   
Formatting Excel from Access

  Donate Today!   Email to Friend  Tell a Friend   Show Printable Version  Print   Contact sikhphilosophy.net Administraion for any Suggestions, Ideas, Feedback.  Feedback  

Register to Remove Advertisements
Hi!
Is there a way to format Excel from Access? I am exporting a table with
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/6270-formatting-excel-from-access.html
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6270
X Columns from Access to Excel and I would like the first row to be
lets say Italic and bold and the textcolor would be red and all the
others would be yellow, the fill color would be red and the would be
font 14. The format would take place only from the first to the last
column(X) where i have some data and to the last row with data.
Just tell me how can i select a section of a sheet like A11 and
format it.
Thanks!

Danijela



Got anything to share on This Topic? Why not share your immediate thoughts/reaction with us! Login Now! or Sign Up Today! to share your views... Gurfateh!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-Nov-2005, 13:40 PM
Douglas J Steele's Avatar Douglas J Steele
Guest
 
Posts: n/a
   
   
Re: Formatting Excel from Access

If you'd looked back a couple of days, you would have found the following
response I gave Andrew Gabb in a thread entitled "Manipulating Excel from
Access":



Easiest way is to do what it is you want one-time in Excel, recording it as
a macro.

Once you're done, look at the VBA code Excel uses, and adapt it for use from
Access.

For example, assume you want the first row (the field titles) to be bold,
and each of the columns to be expanded to be large enough to show all of the
data. Recording what's necessary in Excel to accomplish this will give the
following macro:

Rows("1:1").Select
Selection.Font.Bold = True
Columns("A:A").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Columns.AutoFit

Unfortunately, it's not quite as simple as just plugging that code into
Access.

Because Excel assumes that the VBA code is working with Excel objects, it
can take a few shortcuts with referring to the objects. When you're running
from inside of Access, you have to be explicit. It's not sufficient, for
example, to refer to Rows: you need to indicate Rows on which spreadsheet.
As well, it's not really necessary to create a selection and then refer to
that selection, the way Excel does: you can combine those two steps into
one.

Note, too, that the 3rd line of code about refers to an intrinsic Excel
constant xlToRight (if you're not that familiar with Excel VBA,
Selection.End(xlToRight) lets you extend the current selection to the right
until the last populated cell. In this case, since the selection is a
column, this means that the resultant range will be all contiguous columns
that have some data in them.) It you're using Late Binding, Access has no
idea what the value of that constant is, so it's necessary to provide the
actual value.

In the end, the following code will perform the desired formatting.

With objActiveWkb.Worksheets(intCurrSheet)
.Rows("1:1").Font.Bold = True
.Range(.Columns(1), .Columns(1).End(-4161)) _
.Columns.Autofit
End With


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


wrote in message
news:1130777441.421211.299930@o13g2000cwo.googlegr oups.com...
> Hi!
> Is there a way to format Excel from Access? I am exporting a table with
> X Columns from Access to Excel and I would like the first row to be
> lets say Italic and bold and the textcolor would be red and all the
> others would be yellow, the fill color would be red and the would be
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6270
> font 14. The format would take place only from the first to the last
> column(X) where i have some data and to the last row with data.
> Just tell me how can i select a section of a sheet like A11 and
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6270
> format it.
> Thanks!
>
> Danijela
>



Reply With Quote
  #3 (permalink)  
Old 01-Nov-2005, 13:40 PM
danijela.simunovic@gmail.com's Avatar danijela.simunovic@gmail.com
Guest
 
Posts: n/a
   
   
Re: Formatting Excel from Access

Thanks! just one question: What do i have to put instead of
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6270
"intCurrSheet" and "objActiveWkb"?

Reply With Quote
  #4 (permalink)  
Old 01-Nov-2005, 13:40 PM
Douglas J Steele's Avatar Douglas J Steele
Guest
 
Posts: n/a
   
   
Re: Formatting Excel from Access

The code assumes that you're using Automation along the following lines:
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6270

Dim objActiveWkb As Object
Dim objXL As Object
Dim strWkbName As String

Set objXL = CreateObject("Excel.Application")
objXL.Application.Workbooks.Open "C:\Data\MyBook.xls"
Set objActiveWkb = objXL.Application.ActiveWorkbook

With objActiveWkb.Worksheets(intCurrSheet)

where intCurrSheet is the number of the worksheet (1 is the first sheet, 2
is the second sheet, and so on)

(replace C:\Data\MyBook.xls with the appropriate path to your workbook)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


wrote in message
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6270
news:1130779660.329296.206260@g47g2000cwa.googlegr oups.com...
> Thanks! just one question: What do i have to put instead of
> "intCurrSheet" and "objActiveWkb"?
>



Reply With Quote
  #5 (permalink)  
Old 01-Nov-2005, 13:40 PM
danijela.simunovic@gmail.com's Avatar danijela.simunovic@gmail.com
Guest
 
Posts: n/a
   
   
Re: Formatting Excel from Access

Thanks! I got the hang of it! Bu still I don't know how to get the
border color or border thickness and most important fill color!? Can
you help me out?
I tried .Range("A120").Fill.Color = Red .... and so on but no luck!
Thanks in advance!

Danijela
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6270

Reply With Quote
  #6 (permalink)  
Old 02-Nov-2005, 11:47 AM
Douglas J Steele's Avatar Douglas J Steele
Guest
 
Posts: n/a
   
   
Re: Formatting Excel from Access

Looking in the Excel help file, the Fill property doesn't appear to apply to
ranges, but is part of Charting.

If you're trying to set a colour for the interior of the cells in your
range, you need something like:

With objActiveWkb.Worksheets(1)
With .Range("A110").Interior
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6270
.ColorIndex = 3
.Pattern = 1 ' xlSolid
.PatternColorIndex = -4105 ' xlAutomatic
End With
End With

Note that as I said before, since my code uses late binding, I can't use the
intrinsic constants like xlSolid and xlAutomatic Excel uses. Therefore, I'm
using the numeric values of those constants, but include the name of the
constant for documentation purposes.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


wrote in message
news:1130802022.767625.169100@g43g2000cwa.googlegr oups.com...
> Thanks! I got the hang of it! Bu still I don't know how to get the
> border color or border thickness and most important fill color!? Can
> you help me out?
> I tried .Range("A120").Fill.Color = Red .... and so on but no luck!
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6270
> Thanks in advance!
>
> Danijela
>



Reply With Quote
  #7 (permalink)  
Old 02-Nov-2005, 11:47 AM
danijela.simunovic@gmail.com's Avatar danijela.simunovic@gmail.com
Guest
 
Posts: n/a
   
   
Re: Formatting Excel from Access

I have no words!!! Thanks!
I'll try to find how to get border style and color and font style and
color and if I get stuck i'll post to the news hoping that I'll get an
answer from you or somebody...
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6270
Thanks again because your answers were very very helpfull!!

Danijela

Reply With Quote
  #8 (permalink)  
Old 02-Nov-2005, 11:47 AM
Douglas J Steele's Avatar Douglas J Steele
Guest
 
Posts: n/a
   
   
Re: Formatting Excel from Access

  Donate Today!  
As I said, use the Macro Recorder in Excel as a starting point. At least
then you'll know the correct objects!

Good luck.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


wrote in message
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6270
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6270
news:1130850200.361569.4200@g43g2000cwa.googlegrou ps.com...
> I have no words!!! Thanks!
> I'll try to find how to get border style and color and font style and
> color and if I get stuck i'll post to the news hoping that I'll get an
> answer from you or somebody...
> Thanks again because your answers were very very helpfull!!
>
> Danijela
>



Reply With Quote
   Click Here to Donate Now!

Support Us!
Become a Promoter!
Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh!
ReplyPost New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!

Bookmarks


(View-All Members who have read this thread : 0
There are no names to display.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Tools Search
Search:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

» Active Discussions
Woolwich Killing: The...
Today 03:50 AM
2 Replies, 47 Views
Rozana Reports (ਪੰਜਾਬੀ...
Today 03:09 AM
316 Replies, 7,627 Views
Sikh Spokesman (ਪੰਜਾਬੀ...
Today 03:00 AM
179 Replies, 4,530 Views
How does Sikhi help you...
Today 00:52 AM
31 Replies, 972 Views
Transgenderism ... Right...
By Kaylee
Today 00:33 AM
25 Replies, 1,246 Views
Losing My Religion: Why...
Today 00:00 AM
14 Replies, 373 Views
Occultism - Rejection in...
Yesterday 23:57 PM
61 Replies, 2,619 Views
Kirtan
Yesterday 21:24 PM
0 Replies, 32 Views
Panjabi
Yesterday 21:22 PM
15 Replies, 302 Views
Keeping Amrit Vela
Yesterday 16:49 PM
12 Replies, 936 Views
Do you believe in...
Yesterday 15:08 PM
196 Replies, 4,106 Views
Black Sikhs?
Yesterday 06:33 AM
20 Replies, 5,870 Views
Man Driving Without...
Yesterday 05:06 AM
5 Replies, 147 Views
Request for assistance...
Yesterday 04:24 AM
8 Replies, 97 Views
Health Exercise And...
Yesterday 02:10 AM
1 Replies, 97 Views
» Books You Should Read...
Powered by vBadvanced CMPS v3.2.3
All times are GMT +6.5. The time now is 04:15 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2 Copyright © 2004-12, All Rights Reserved. Sikh Philosophy Network


Page generated in 0.58802 seconds with 32 queries
0