Re: Embedded XML Workbook

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



"Chris Jones" <chris.jones@xxxxxxxxx> wrote in message
news:12chigp2ism2je4@xxxxxxxxxxxxxxxxxxxxx

OK, perhaps thats too complicated to implement. How about simply
populating an excel workbook in the same folder as the source code and
then being able to update it?

populating a text box from an excel workbook*********

Sorry, just noticed the new replies. Yes, you can get info from your Excel
workbook. How you go about it depends on a couple of things. The main
question is "Will the end user have Excel installed?" More than likely the
answer is yes, but it's not a guarantee. If yes, you can use Automation to
read the data. If no, you can use ADO to read it, but the workbook will have
to be structured "nicely."

We'll assume the user will have Excel. Let's say your data is in cell B4 on
the first *** of your workbook. The following code will be pretty close to
what you need to do. (I say pretty close because I'm doing this off the top
of my head and I may get something wrong. It should be a good head start,
though.)

Dim xlApp As Object

Set xlApp = CreateObject("Excel.Application")
xlApp.Workbooks.Open "C:\SomeFolder\MyWorkbook.xls"
txtWhatever.Text = xlApp.Workbooks(0).Sheets(0).Range("B4").Value

If your user won't have Excel, post back and I'll show you the ADO way.


.


Quantcast