Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 23rd, 2007, 04:40 AM
Registered User
 
Join Date: Jan 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Wrong Colors in Excel when exporting from Access

I have to export some data with DoCmd.OutputTo or DoCmd.TransferSpreadsheet into Excel and format the Data (Colors, Cell width, etc).

But there's one problem, the color palette changes from default to something else (see links). Now, when I try to set backgroundcolors with .Interior.Color or .Interior.ColorIndex, the Colors are all crap.

Anyone can help?

right: http://img228.imageshack.us/img228/5...rsright2zz.jpg
wrong: http://img258.imageshack.us/img258/3...rswrong5ns.jpg
 
Old January 23rd, 2007, 08:38 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

It looks like Access has a different custom color pallette than Excel. What values are you using for the pallatte? Can you cahnge to RGB values, for example?


mmcdonal
 
Old January 23rd, 2007, 08:50 AM
Registered User
 
Join Date: Jan 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Same thought here.

I tried using RGB, but that's not working either.

I have to use ColorIndex 46 (that's light orange or #FF9900 or 255,153,0). Problem here is that I can't define that color, it is rounded in some sort. I get the same yellow down to somewhere around 255,130,0, then it changes to red.

There are some funny things too:
- when I create a new Excel File in Excel, Color Pallette is OK.
- when I export the data manually (with export function from Access, not VBA), Color Pallette is OK
- only when exporting (through DoCmd.OutputTo or DoCmd.TransferSpreadsheet) in VBA, Color Pallette is not OK

I really hate things like this...

simon
 
Old January 23rd, 2007, 09:14 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Try this article: http://support.microsoft.com/default...288412&sd=tech

My understanding is that if you deviate from Excel's limited color pallette, you will get an approximation by Excel. Think of it as dumb dithering. See if the article helps to set the pallette. I am not sure it will.


mmcdonal
 
Old January 23rd, 2007, 11:46 AM
Registered User
 
Join Date: Jan 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, if anyone knows a way to change the default color pallette by VBA, that would it be ;) But thanks anyway.

I tried to use decimal value for FF9900, but that didn't work either.
 
Old April 19th, 2007, 01:22 PM
Registered User
 
Join Date: Apr 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I had the same problem with VBA creating an Excel spreadsheet from Access.

Use this Excel command in VBA... .ActiveWorkbook.ResetColors

This will reset the color pallette to what you want.

Good Luck,

MGreenInOKC

mgreen





Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting From Access To Excel jimnich Access VBA 17 February 8th, 2008 07:23 AM
Maintaining custom colors when exporting to Excel jocchino Reporting Services 0 May 28th, 2007 05:09 PM
Exporting form Access Database to Excel asters VB.NET 2002/2003 Basics 5 April 13th, 2007 02:23 PM
Exporting to Excel from Access - field headings no chimp Access VBA 1 July 9th, 2004 11:54 AM
exporting a workbook from excel to access zisko3 Access 1 February 3rd, 2004 12:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.