Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
DP DP is offline
external usenet poster
 
Posts: 58
Default Using Excel Library

Hi everyone:

I am tring to develop a product in MS Access. I have a query that uses VBA
programing to open an excel sheet and export data to it.

It works fine, except I would like to do some formatting like underlines and
bold and unfortunately I am getting application defined errors.

xlc.TextEffect.FontBold = True

I have not included the Excel 11 library in the reference, I am sure there
is where the goodies are, however, I am affaid if the user has a lower
version of Office what will occur, will it throw an error.

I have just called my objects in VBA like this to make it simple

Set xlx = CreateObject("Excel.Application")

Does anybody have any experience with this?

Thanks





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Using Excel Library

"dp" wrote in message
...
It works fine, except I would like to do some formatting like underlines
and
bold and unfortunately I am getting application defined errors.

xlc.TextEffect.FontBold = True


The reason this fails is because it's not a valid construct in the Excel
object model.

I have not included the Excel 11 library in the reference, I am sure there
is where the goodies are, however, I am affaid if the user has a lower
version of Office what will occur, will it throw an error.


You are correct about this. What you should do is develop your
application with a reference set to the Excel object library and all of your
variables declared with the correct Excel object types. That way you can
"see" what you are doing in the Excel object model. Once you're sure it all
works and you're ready to deploy it, remove the Excel reference and change
all the Excel-specific object variable declarations to "As Object".

Keep in mind there have been new features added to the object model in
each version of Excel, so things you can do in Excel 2003 will not always
work in earlier versions of Excel. Unfortunately, there aren't any good
resources to determine what is new and what isn't, so your best bet is to
find a machine with the earliest version of Excel you expect your
application to run on and test it there.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Using Excel Library

There is an example of Rob' suggestion at
http://www.xldynamic.com/source/xld.EarlyLate.html. It refers to Outlook,
but the principle is the same.

--
HTH

Bob Phillips

"Rob Bovey" wrote in message
...
"dp" wrote in message
...
It works fine, except I would like to do some formatting like underlines
and
bold and unfortunately I am getting application defined errors.

xlc.TextEffect.FontBold = True


The reason this fails is because it's not a valid construct in the

Excel
object model.

I have not included the Excel 11 library in the reference, I am sure

there
is where the goodies are, however, I am affaid if the user has a lower
version of Office what will occur, will it throw an error.


You are correct about this. What you should do is develop your
application with a reference set to the Excel object library and all of

your
variables declared with the correct Excel object types. That way you can
"see" what you are doing in the Excel object model. Once you're sure it

all
works and you're ready to deploy it, remove the Excel reference and change
all the Excel-specific object variable declarations to "As Object".

Keep in mind there have been new features added to the object model in
each version of Excel, so things you can do in Excel 2003 will not always
work in earlier versions of Excel. Unfortunately, there aren't any good
resources to determine what is new and what isn't, so your best bet is to
find a machine with the earliest version of Excel you expect your
application to run on and test it there.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm





  #4   Report Post  
Posted to microsoft.public.excel.programming
DP DP is offline
external usenet poster
 
Posts: 58
Default Using Excel Library

Hi Rob:

Thanks for your response.

I did try your suggestion. Its really cool to see all those object and
functions.

I tried to do a border around a range

Dim rng As Excel.Range

rng.BorderAround 1, -4138

I got the values by using the intermediate window
changed the xlmedium to those values, etc
removed the xls library
changed dim rng as object


Thanks,
I dont have a lower version of excel to test it on now. Hmm


"Rob Bovey" wrote:

"dp" wrote in message
...
It works fine, except I would like to do some formatting like underlines
and
bold and unfortunately I am getting application defined errors.

xlc.TextEffect.FontBold = True


The reason this fails is because it's not a valid construct in the Excel
object model.

I have not included the Excel 11 library in the reference, I am sure there
is where the goodies are, however, I am affaid if the user has a lower
version of Office what will occur, will it throw an error.


You are correct about this. What you should do is develop your
application with a reference set to the Excel object library and all of your
variables declared with the correct Excel object types. That way you can
"see" what you are doing in the Excel object model. Once you're sure it all
works and you're ready to deploy it, remove the Excel reference and change
all the Excel-specific object variable declarations to "As Object".

Keep in mind there have been new features added to the object model in
each version of Excel, so things you can do in Excel 2003 will not always
work in earlier versions of Excel. Unfortunately, there aren't any good
resources to determine what is new and what isn't, so your best bet is to
find a machine with the earliest version of Excel you expect your
application to run on and test it there.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Library in Excel Line Nissen Excel Discussion (Misc queries) 1 March 4th 10 01:24 PM
Excel Library not registered. Kart Excel Discussion (Misc queries) 0 February 17th 09 11:21 AM
Excel 11.0 Object Library Al Excel Programming 2 November 12th 04 04:32 PM
Reference Library - Missing Library in a lower version. luvgreen Excel Programming 1 October 7th 04 02:08 AM
Excel Library Henning Eiben Excel Programming 6 October 6th 04 10:04 AM


All times are GMT +1. The time now is 10:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"