PDA

View Full Version : Complex workbook_open solution needed



percy4
04-23-2009, 06:54 AM
Hi Guys,

I need some help with a pretty complex (at least for me) VBA code that should do the following:

When I open file “A” (via the “workbook_open”) file “B” would be opening in the background (not visible to the user) then file “A” will “refresh all” while showing a status bar to the user. Once file “A” is refreshed file “B” should be closed and the user a gets a message stating “Data refreshed”.

The reason for opening file “B” is that file “A” contains a lot of links to file “B” and is therefore gets a very much faster refresh time if file “B” is open.

What I have come up with so far is following. Since I am VERY new to VBA programming I would also appreciate your input on below code.

Thanks for any help I could get!!

Regards
Per


Private Sub Workbook_Open()

Dim wSheet As Worksheet


For Each wSheet In Worksheets
wSheet.Protect Password:="secret password", _
UserInterFaceOnly:=True
For Each wSheet In Worksheets.EnableAutoFilter = True
Next wSheet

End Sub