VBA to activate workbook opened from email

Johndinho

Board Regular
Joined
Mar 21, 2013
Messages
90
Hi,

I have written and tested code which works brilliantly (Not to brag) and I have sent the file to all in my organisation to use.

Part of the functionality is to email me a copy of their file. I then run another piece of code to copy data (theirs and mine I enter) from the emailed workbook to a master file.

But.....

The emailed file when opened changes the filename - "book1(01).xlsx" or "book1(001-1).xlsx" My code for the copy and paste states

workbooks("book1").Activate

Is there a way to instruct VBA to reactivate the variable filename I received on the email?

I'm guessing it might be nominating the temp file name as a string then using that in the activate line? But I don't know how to do that.

Any suggestions would be great

Thanks,

Johndinho
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,214,559
Messages
6,120,203
Members
448,951
Latest member
jennlynn

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