I've been using Dim x as String variables and I've been playing around with Public instead and I'm having a problem making one work.
In my testing, I've gotten this to work starting from a brand new book with two brand new modules:
Public testVar As String
testVar = "testing testing one two"
ActiveCell.FormulaR1C1 = testVar
When I run the testtwo macro, it fills in "testing testing one two" into the currently active cell. My next attempt at playing around is dealing with opening an existing workbook (as part of a much larger macro).
In my testing, again with a brand new workbook and two new modules, this is what I have but it's not working:
Public filePath As String
filePath = "W:\IT\Zach\Sales Journal\Testing\"
Workbooks.Open Filename:=filePath & "Files\Toms_Variance_Setup.xlsm"
This time, when I run the fptwo macro, I get an error saying it can't find the 'Files\Toms_Variance_Setup.xlsm' file since it's not using the filePath variable string in the file path. the fptwo macro DOES work if I put the filePath variable inside it instead of fpone.
I'm wondering why does this work in my first example but not the second?
Will this work with some tweaking or is this just not possible?