AnyOldName
New Member
- Joined
- May 18, 2019
- Messages
- 8
Is there a way toset the value of a workbook variable from another variable that holds a string?
I already have oneaction that does this by using ActiveWorkbook ,as shown below, but I have twoother workbooks that is are data templates, one of which will be opened up bythe macro.
Public Var_Code_WorkbookName As Workbook
Set Var_Code_WorkbookName = ActiveWorkbook
Debug.Print "DRPS Code Workbook is: " & Var_DRPS_Code_WorkbookName.FullName
Is there a way to do the same thing but referencing the value of a string rather than using ActiveWorkbook?
Public Var_Data_Template1 As Workbook
Public Var_Template_Type As String 'This variable holds the file path & filename of the data template workbook, those values are picked up from elsewhere in the code
'eg C:\User\VBA Code\ Excel File.xlsx
Set Var_Data_Template1 = Var_Template_Type
I can't figure out a method or the syntax for this last line, can anyone advise if its possible? Thankyou
I already have oneaction that does this by using ActiveWorkbook ,as shown below, but I have twoother workbooks that is are data templates, one of which will be opened up bythe macro.
Public Var_Code_WorkbookName As Workbook
Set Var_Code_WorkbookName = ActiveWorkbook
Debug.Print "DRPS Code Workbook is: " & Var_DRPS_Code_WorkbookName.FullName
Is there a way to do the same thing but referencing the value of a string rather than using ActiveWorkbook?
Public Var_Data_Template1 As Workbook
Public Var_Template_Type As String 'This variable holds the file path & filename of the data template workbook, those values are picked up from elsewhere in the code
'eg C:\User\VBA Code\ Excel File.xlsx
Set Var_Data_Template1 = Var_Template_Type
I can't figure out a method or the syntax for this last line, can anyone advise if its possible? Thankyou