Macro to open, Update links, save and close workbooks

A

Anton

I have a few workbooks on our server that need to be opened, links updated,
saved and then closed again. It has to be done in a specific sequence and
each workbook has the same writeres password. I'm thinking along the lines of
having a master workbook open containing the macro. When I leave work in the
evening I can start the Macro and have all the workbooks updated by the next
morning. I have been testing this on one book only. It opens and updates but
it doesn't want to close it.
I don't know much about VBA and sort of been figuring things out as I go
along.

This is what I've been trying:

Sub OpenUpdateClose()
'
' OpenUpdateClose Macro
' Opens all workbooks, Updates them then saves and closes them
'
' Keyboard Shortcut: Ctrl+Shift+O
'
Dim wbk As Workbook

Application.DisplayAlerts = False

Set wbk = Workbooks.Open(Filename:="filename1.xls", _
UpdateLinks:=True, _
writeresPassword:="password")

With wbk
.Save
.Close
End With

Set wbk = Nothing


End Sub

Thanks in advance for the help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top