Converting Application.ActiveWorkbook.Path to Application.ActiveWorkbook.FullName in specific line of VBA

SkywardPalm

Board Regular
Joined
Oct 23, 2021
Messages
61
Office Version
  1. 365
Platform
  1. Windows
How should I go about converting this path to a dynamic path with file name that could be changing.

VBA Code:
activeWorkbookPath = "'" & ActiveWorkbook.Path & "\[Variance Analysis Template v5.xlsm]temp_data'!R1C1:R" & LastRowCurrent & "C3"

I've read that I can use
VBA Code:
Application.ActiveWorkbook.FullName
to accomplish this, but am not sure how to convert this specific line of VBA to incorporate it with the other specifics within the line.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Hi. I wouldn't use ActiveWorkbook.FullName in this instance because it includes the directory path as well, which you've already captured in the above formulation with Activeworkbook.Path. Instead, I'd suggest just replacing the file name part above with ActiveWorkbook.Name as follows:

VBA Code:
activeWorkbookPath = "'" & ActiveWorkbook.path & "\[" & ActiveWorkbook.Name & "]temp_data'!R1C1:R" & LastRowCurrent & "C3"

Note that this retains the temp_data sheet name, if that's what you're intending.
 
Upvote 0
Solution

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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