[AccessD] Excel Automation ... Setting Default Formatting InExcel

Lawrence Mrazek lmrazek at lcm-res.com
Fri Mar 31 13:06:44 CST 2006


Thanks Jim:

I'm currently using the following code to create my workbook:
Set xlApp = New Excel.Application
    xlApp.Visible = True
    Set xlWb = xlApp.Workbooks.Add

To use a template, do I simply alter the last line so that it points to a
template?

    Set xlWb = xlApp.Workbooks.Add("c:\template.xlt")

Also, how do you make sure that each new worksheet inherits the template's
formatting? I'm using the following code to add the worksheet:

Set xlWs = xlWb.Worksheets.Add

Thanks in advance for all of your advice.

Larry Mrazek
LCM Research, Inc.
www.lcm-res.com
lmrazek at lcm-res.com
ph. 314.432.5886
fx. 314.432.3304


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Hale, Jim
Sent: Thursday, March 30, 2006 5:47 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Excel Automation ... Setting Default Formatting
InExcel

I use a template with a worksheet formatted the way I need. After opening
the template in code I create as many sheets as needed copying the
preformatted sheet. This is better then slugging it out in vba since the
inevitable tweaks to the format can be handled by simply changing the
template.


Jim Hale

-----Original Message-----
From: Lawrence Mrazek [mailto:lmrazek at lcm-res.com]
Sent: Thursday, March 30, 2006 3:27 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Excel Automation ... Setting Default Formatting In Excel


Hi:

I have a fairly complex Access to Excel automation project, and having
conquered my named ranges issue, I'm wondering about the best way to set
default formatting for columns (percentages, decimals, conditional formats).

The application dynamically creates worksheets in the Excel workbook
(sometimes it has 5 worksheets, sometimes more) from data stored in Access. 

The data will always be in the same columns, (EX: column M is percent,
Column N is 2 decimals, etc.); Can I have Excel set defaults for these
columns before exporting/creating the data, or is it better to just do this
in VBA?

Thanks in advance.

Larry Mrazek
LCM Research, Inc.
www.lcm-res.com
lmrazek at lcm-res.com
ph. 314.432.5886
fx. 314.432.3304

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

***********************************************************************
The information transmitted is intended solely for the individual or entity
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of or
taking action in reliance upon this information by persons or entities other
than the intended recipient is prohibited.
If you have received this email in error please contact the sender and
delete the material from any computer. As a recipient of this email, you are
responsible for screening its contents and the contents of any attachments
for the presence of viruses. No liability is accepted for any damages caused
by any virus transmitted by this email.
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list