Good morning
I am trying to open a spreadsheet via vba to copy pieces of data into my current workbook.
I have a formula that changes the name based on the date etc.. that shows in the "telstats" reference below. (this changes daily)
I am getting an error on the "Set wb2" saying I have a syntax error, but I am unsure what I have missed as I normally use a static name instead of one that changes.
thanks in advance
I am trying to open a spreadsheet via vba to copy pieces of data into my current workbook.
I have a formula that changes the name based on the date etc.. that shows in the "telstats" reference below. (this changes daily)
I am getting an error on the "Set wb2" saying I have a syntax error, but I am unsure what I have missed as I normally use a static name instead of one that changes.
thanks in advance
Code:
Dim wb1 As Workbook, wb2 As Workbook
Dim telstats As String, Dim r As Range
Application.DisplayAlerts = False
Application.ScreenUpdating = False
telstats = Worksheets("Running System").Range("C9").Value
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("C:\Users\" & Environ("username") & "\OneDrive - Verastar\" & telstats & "))
[code/]