VBA code to activate a already opened Excel workbook using a dynamic naming convention.

fwk

New Member
Joined
Jan 9, 2024
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Good morning.
I have a workbook in which all the VBA code is in. I use the code to extract SAP data which then opens a new workbook when it downloads the data. The workbook name will be different each week as the data is downloaded weekly. Below is the spreadsheet in the workbook which calculates a dynamic name for the new file that's downloaded based on the week number. All coding up to this point works perfectly.
1716247441447.png

When i want the code to save the file (Which is open and has a name), the code gets stuck here where i have set a dimensions which reads the cell as indicated above.
1716247672955.png

1716247851892.png

When i replace the dimension with the name of the workbook, the code works fine. I however have to automate the name as it changes on a weekly basis.

I please need assistance with this error to either find a workaround or getting the code to work.

Thanks
FWK
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Maybe....
VBA Code:
IW47FileNameOne = CSTR(ActiveWorkbook.Activesheet.Range("R11").Value) & ".xlsm"
HTH. Dave
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,175
Members
452,615
Latest member
bogeys2birdies

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