WORKING ON WORKBOOK WITHOUT OPENING IT

I am doing some changes in a workbook.

The first thing I do is to open it. Then I do the changes. Then I save it and close it.

Is it possible to effect the changes without opening the workbook

This is the code:

directory = "c:\Documents and Settings\Antonio\My Documents\Client "

Workbooks.Open directory & "Geroa\Geroa Inventory.xls", 0

Worksheets("renta variable").Activate
Worksheets("renta variable").UsedRange.Select


ROW_COUNT = Selection.Rows.Count


For I = 2 To ROW_COUNT

If Cells(I, 1).Value = bloomberg_stock_ticker Then

Match = True

Cells(I, 2).Value = Cells(I, 2).Value + shares_traded_for_client

If Cells(I, 2) = 0 Then

ROW_COUNT = ROW_COUNT - 1

Cells(I, 2).Select

ActiveCell.EntireRow.Delete

End If

End If


Next


If Not Match Then


Cells(ROW_COUNT + 1, 1) = bloomberg_stock_ticker

Cells(ROW_COUNT + 1, 2) = shares_traded_for_client

End If

ActiveWorkbook.Close SaveChanges:=True



Answer this question

WORKING ON WORKBOOK WITHOUT OPENING IT

  • Meylum

    Hey man,

    ExcelML is only avaliable in Office XP and 2003. If you have those versions create a realy simple worksheet and save it as xml, then open the saved file in Notepad. This will give you an example of what ExcelML looks like. All thebest.



  • phox

    Hi there!

    Yes, I have Office 2003 and just did what you said.

    It is quite clear now the workbook contents are accessible to manipulation.

    It should be easy enough to carry out small changes.

    However, to replicate the full functionality of all the VBA for Excel methods available when the workbook is open one would need a lot of work....


  • Jim Vinsel

    Hi again Derek,

    That is a very informative answer. It was exactly what I had in mind, Excel is able to retrieve data from a closed file but I agree that it is best left to Excel.

    However, your suggestion to store files in XML is great and I will study it.

    Regards,

    Antonio


  • Sat007

    I'd say this isn't possible. Workbooks that are saved in binary xls format have a specific layout. The only application that knows and understands this layout is Excel. The only option would be to learn this binary format and to then save the data to the workbook using it. That's just not advisable.

    It's a problem that most packages which store their own format of files have. Thankfully thats changing, more and more applications are storing their files in XML now, Office packages allow you to do this, OfficeML is an XML file format for Office documents, ExcelML is Excels format. If your file was saved in ExcelML you could access and change the information without needing to open the Workbook fully in excel.



  • WORKING ON WORKBOOK WITHOUT OPENING IT