ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Updateing a workbook from another workbood (https://www.excelbanter.com/excel-programming/386409-updateing-workbook-another-workbood.html)

Robert[_32_]

Updateing a workbook from another workbood
 
I need to open a workbook, update a worksheet, and close the workbook all
from a different workbook. I have tried several approaches and have not been
successful. Can someon please point me to an article or source code to
accomplishe this?

Many Thanks,
--
Robert Hill


Vergel Adriano

Updateing a workbook from another workbood
 
Robert,

The code below will open a workbook, put "Hello, World" in cell A1 of
Sheet1, then save and close the workbook.

Sub test()
Dim wb As Workbook
Set wb = Application.Workbooks.Open("D:\test.xls")
wb.Worksheets("Sheet1").Range("A1").Value = "Hello, World"
wb.Close True
Set wb = Nothing
End Sub


--
Hope that helps.

Vergel Adriano


"Robert" wrote:

I need to open a workbook, update a worksheet, and close the workbook all
from a different workbook. I have tried several approaches and have not been
successful. Can someon please point me to an article or source code to
accomplishe this?

Many Thanks,
--
Robert Hill



All times are GMT +1. The time now is 10:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com