Hi all,
Is it possible to delete a range in a closed workbook, without open it
first?
Any example would be appreciated.
Thanks,
Resant
Hi all,
Is it possible to delete a range in a closed workbook, without open it
first?
Any example would be appreciated.
Thanks,
Resant
You can't do it without opening the workbook, but you can do it without
visibly opening the workbook or seeing that excel is opening. If you
are trying to access the workbook from somewhere other than excel, then
I would suggest using a VB script file. If you are trying to delete
the range from another workbook, then simply use the
application.screenupdating = false to prevent people from seeing that
you are opening the workbook. Something like this:
Sub Macro1()
Dim wbSource As Workbook
Set wbSource = ActiveWorkbook
Application.ScreenUpdating = False
'open the file
Workbooks.Open Filename:="C:\My Documents\MyFile.xls"
'delete the range
Sheet1.Range("H3:H8").ClearContents
'close the workbook and save
ActiveWorkbook.Close True
'restore original workbook as active workbook
wbSource.Activate
Application.ScreenUpdating = True
End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks