jardenp
Active Member
- Joined
- May 12, 2009
- Messages
- 373
- Office Version
- 2019
- 2016
- 2013
- 2011
- 2010
- Platform
- Windows
I am trying to assign a workbook name to a String variable
When I try to call this later, I get an error
My testing shows this is because the WeeklyRoutesWorkbook contains an apostrophe (i.e., the original ActiveWorkbook name contains an apostrophe).
Is there a way around this? This script will be run on many workbooks, which all contain an apostrophe in their names.
I looked at this but couldn't make sense of it: https://msdn.microsoft.com/en-us/library/office/aa212167(v=office.11).aspx
Thanks!
JP in IN
Code:
Dim WeeklyRoutesWorkbook As String
WeeklyRoutesWorkbook = ActiveWorkbook.Name
Code:
Range("G2").FormulaR1C1 = _
"=VLOOKUP(RC[-1],'[" & WeeklyRoutesWorkbook & "]Sheet1'!C5:C9,5,FALSE)"
Is there a way around this? This script will be run on many workbooks, which all contain an apostrophe in their names.
I looked at this but couldn't make sense of it: https://msdn.microsoft.com/en-us/library/office/aa212167(v=office.11).aspx
Thanks!
JP in IN