msvisual.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CreateObject("Excel.Application")

 
Post new topic   Reply to topic    msvisual.com Forum Index -> VB Enterprise
Author Message
Tom Gaughan



Joined: 04 Oct 2007
Posts: 3

PostPosted: Wed Sep 10, 2003 9:28 pm    Post subject: CreateObject("Excel.Application") Reply with quote

I'm exporting a data grid to an Excel spreadsheet. I'm looking for a way to
set the column formatting. We're having a problem with Excel using
exponential values for a text field that is 14 numeric characters. Is there
a way to access a Properties collection of the Excel.Application object to
iterate through in order to determine what the property name and values
are - or at least some documentation.

Thanks,
Tom

Code used to set up some column formulas etc.:

Set xlobj = GetObject(, "Excel.Application")

With xlobj

.workbooks.Open (strFileName)

With .ActiveSheet ' Paste the criteria into first sheet

j = 65 ' start at column A

For c = 0 To dataGrid.Columns.Count - 1

If (dataGrid.Columns(c).Visible = True) Then

.Range(Chr(j) & 1).Insert
.Range(Chr(j) & 1).Font.Bold = True
.Range(Chr(j) & 1).FormulaR1C1 =
dataGrid.Columns(c).Caption
j = j + 1

End If

Next c
End With

End With

Archived from group: microsoft>public>vb>enterprise
Back to top
View user's profile Send private message
Bob Butler



Joined: 04 Oct 2007
Posts: 2047

PostPosted: Wed Sep 10, 2003 8:34 pm    Post subject: Re: CreateObject("Excel.Application") Reply with quote

"Tom Gaughan" wrote in message%23dDHA.2408@TK2MSFTNGP09.phx.gbl
> I'm exporting a data grid to an Excel spreadsheet. I'm looking for a
> way to set the column formatting. We're having a problem with Excel
> using exponential values for a text field that is 14 numeric
> characters. Is there a way to access a Properties collection of the
> Excel.Application object to iterate through in order to determine
> what the property name and values are - or at least some
> documentation.

start excel, start recording a macro, walk through what you want to do
manually, stop recording and look at the code that was generated. it's
often not the best code but it almost always identifies the obejcts and
properties that you need to use from your own code.

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    msvisual.com Forum Index -> VB Enterprise All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group