Excel sheet component-how do you connect?

Excel sheet component-how do you connect?

Anonymous
Not applicable
532 Views
6 Replies
Message 1 of 7

Excel sheet component-how do you connect?

Anonymous
Not applicable
I looking for any information on how to access the cells for MS office excel
web sheet component. I'm trying to find out if I can use this instead of
linking
to excel. I'd like to use it as a container for a ton of station and offset
values and can't find out how to connect to this if it at all possible.
a search in the group was very limited. any ideas.

Thank you
John coon
0 Likes
533 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
Public Sub test()
Dim excel As Object
Dim excelSheet As Object
Set excel = GetObject(, "Excel.Application")
excel.Worksheets("Sheet1").Activate
Set excelSheet = excel.ActiveWorkbook.Sheets("Sheet1")
excelSheet.Cells(1, 5).Value = "A"
End Sub

this what you mean?
0 Likes
Message 3 of 7

Anonymous
Not applicable
You can also use ADO if you only need a storage medium. Let me know, and
I'll look up the connection string.
--
John Goodfellow
irtfnm
use john at goodfellowassoc dot com


wrote in message news:5067649@discussion.autodesk.com...
Public Sub test()
Dim excel As Object
Dim excelSheet As Object
Set excel = GetObject(, "Excel.Application")
excel.Worksheets("Sheet1").Activate
Set excelSheet = excel.ActiveWorkbook.Sheets("Sheet1")
excelSheet.Cells(1, 5).Value = "A"
End Sub

this what you mean?
0 Likes
Message 4 of 7

fxcastil
Advocate
Advocate
John,
Yes you can use the OWC10.DLL spreadsheet control instead of Excel. The advantage is that you now imbed a mini Excel in your autocad. The disadvantage it does not have all the features of full excel but it has almost all of the the main features. To use the MsOffice web sheet component just add a reference to it in your AutoCAD VBA project. Add the control to Controls Toolox . Then just add the spreadsheet control to a userform. You may have to use "regsvr32" to register the dll file. A nice manual is located in the same directory as the OWC10.DLL file. Look in program files/common files/microsoft shared/web components directory. Also use the object browser to see all the features of the OWC10.DLL control. Unfortunately the help for the owc10.dll does not work in AutoCAD but it does work in Excel. I usually try out the spreadsheet control in Excel where the help will work if I have any problems. Import the attached form to a VBA project in AutoCAD or Excel VBA.
Search the web and microsoft msdn for more info on using theOWC10.dll (spreadsheet control)

Fred Castillo
0 Likes
Message 5 of 7

Anonymous
Not applicable
John & Squid,
So you can connect just as a normal excel object?
I'm headed to the office. I'm add the excel normal object connection and see
what that does.
I'm sure I'll be back.

Thank you so much for the help.
John Coon

"John Goodfellow" wrote in message
news:5067716@discussion.autodesk.com...
You can also use ADO if you only need a storage medium. Let me know, and
I'll look up the connection string.
--
John Goodfellow
irtfnm
use john at goodfellowassoc dot com


wrote in message news:5067649@discussion.autodesk.com...
Public Sub test()
Dim excel As Object
Dim excelSheet As Object
Set excel = GetObject(, "Excel.Application")
excel.Worksheets("Sheet1").Activate
Set excelSheet = excel.ActiveWorkbook.Sheets("Sheet1")
excelSheet.Cells(1, 5).Value = "A"
End Sub

this what you mean?
0 Likes
Message 6 of 7

Anonymous
Not applicable
Fred,

Thanks for the information. I have the excel object inserted into a form but
I'm going to have to do a search for the regsvr32 registration, I don't know
anything about that yet but that's half the fun! If I can get this to work
it seems like a nice alternative when I'm using excel as just a storage
item.

I check the help file.

Thank you
John Coon
wrote in message news:5067753@discussion.autodesk.com...
John,
Yes you can use the OWC10.DLL spreadsheet control instead of Excel. The
advantage is that you now imbed a mini Excel in your autocad. The
disadvantage it does not have all the features of full excel but it has
almost all of the the main features. To use the MsOffice web sheet component
just add a reference to it in your AutoCAD VBA project. Add the control to
Controls Toolox . Then just add the spreadsheet control to a userform. You
may have to use "regsvr32" to register the dll
file. A nice manual is located in the same directory as the OWC10.DLL file.
Look in program files/common files/microsoft shared/web components
directory. Also use the object browser to see all the features of the
OWC10.DLL control. Unfortunately the help for the owc10.dll does not work
in AutoCAD but it does work in Excel. I usually try out the spreadsheet
control in Excel where the help will work if I have any problems. Import the
attached form to a VBA project in AutoCAD or Excel VB=

A.
Search the web and microsoft msdn for more info on using theOWC10.dll
(spreadsheet control)

Fred Castillo
0 Likes
Message 7 of 7

fxcastil
Advocate
Advocate
John,

I am not sure if you understand the difference between the
Microsoft web compnents spreadsheet control OWC10.DLL
or OWC11.DLL and using Microsoft Excel. If you already know then sorry for the blah blah blah.

The Microsoft web components spreadsheet control OWC10.DLL is simply added to a userform and therfore no "connection is required" .

Dim objsht1 As OWC10.Worksheet

With Userform1.Spreadsheet1
Set objsht1 = .Sheets(1)
End with

With objsht1
.cells(1,1) = 100
.cells(1,2) = 200
.cells(1,2) = 200
End With


The example Squid gave would be used if you wanted to connect AutoCAD to an Excel workbook file and use MicroSoft Excel.

The ADO example John is talking about does not apply to using the Microsoft web compnents spreadsheet control OWC10.DLL . ADO is used to connect to a spreadsheet without having Excel or connecting to a database without having Access/Database program. ADO is more "typically" used to read data from a database without the need for database program.

If you were able to add the Spreadsheet to a Userform and display the userform with spreadsheet then you do not need to register the OWC10.DLL using "REGSVR32 " .

Fred Castillo
0 Likes