VBA for Opening a Variably Named File in Excel and Copying it's Workbook Contents to Another Workbook
Posted on 2012-08-13
I have an Excel workbook that is formatted to look like an Invoice (Invoice Template). I also have an Access application that is creating an Excel file - the name of which is both date and time stamped - based on an Access query.
What I would like to do is create a button on the Invoice Template that would run VBA that would copy the contents of a range of cells in the Access created Excel workbook (Target), and paste the data into the Invoice Template. How would I write the code to loop through the cells of the target file and paste the contents into the Invoice Template, assuming all the cells were a one-to-one match?
The main stumbling block for me is dealing with the target Excel workbook because its name would always be a variable because of the date/time stamp naming convention.