Trigger when another file is opened

Ray Bailey

New Member
Joined
Nov 12, 2015
Messages
34
Hi,

First thread so sorry if I don't put my query over fully.

I need a method of recognising when a file is opened so I can then automatically save it to disk.

Reason for this is that I recieve files via email hyperlinks each day which I open and then have to save via Save As options. This might sound like I'm being a bit lazy but the file name is always AUTO.xls and I get around 30 a day. The name of Sheet 1 can be used to denote the name of the output file.

Can't use code in Outlook as the hyper link is actually to a .app file on the webserver.

The following code works fine I just don't know how to automatically trigger this. I presume it needs to be in my Personal.xls file somewhere.


Sub Auto_Save()
Dim sFileNm As String

If Worksheets(1).Name = "DailyPlacementSummar" Then
sFileNm = "C:\Daily Placements " & Format(Date, "dd mm yy") & ".xlsx"
ActiveWorkbook.SaveAs FileName:=sFileNm, Password:="pw1"
ActiveWorkbook.Close
End If
End Sub


Any help will be gratefully received.


Cheers Ray
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,215,528
Messages
6,125,342
Members
449,218
Latest member
Excel Master

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top