bdouglas1011
New Member
- Joined
- Jul 28, 2014
- Messages
- 38
I have a path that I know works because another macro uses it just fine, but now using the same code to point to the same path I get a sorry cant find c:\..... is it possible it was moved or renamed or deleted.
the code that works
Here is the same thing just refer to the actual path as path not directory
It stop here and says the error is with the
The path is still the same "C:\Users\Remote\Desktop\GENERATED_LOGS"
I am confused
please help
the code that works
VBA Code:
Dim r As Integer, F As String, Directory As String
Dim col As Long, row As Long, colLet As String
'get integers for the cell reference in the "Folder Path Cell" on the template sheet
col = wColNumber(colRegEx(Range("CK30").Text))
row = CInt(rowRegEx(Range("CK30").Text))
Directory = cells(row, col).Text
If Right(Directory, 1) <> "\" Then Directory = Directory + "\"
r = row + 1
'Get Directory
F = Dir(Directory)
Do While F <> ""
r = r + 1
cells(r, col + 2) = F
'Get next File
F = Dir()
Loop
Here is the same thing just refer to the actual path as path not directory
VBA Code:
'get integers for the cell reference in the "Folder Path Cell" on the template sheet
col = wColNumber(colRegEx(Range("CK30").Text))
row = CInt(rowRegEx(Range("CK30").Text))
'Turns off screen updates to avoid flashing screen
Application.ScreenUpdating = False
Application.Calculation = xlCalculationAutomatic
'saving the survey sheet object to a variable
Set Surveys = ThisWorkbook.Sheets("Surveys")
'setting the defined path for the survey file
path = cells(row, col).Text
If Right(path, 1) <> "\" Then path = path + "\"
'setting up the generic name for unformatted surveys, "path\<Well Name> Surveys.csv"
Dim unformatSvy As String: unformatSvy = path + Range("g8").Text + " Surveys.csv"
'Find the file marked as the survey file then exit loop
For i = row + 2 To row + 15
If cells(i, col + 11).Value = "Yes" Then
path = path + cells(i, col + 2).Text
Exit For
End If
Next i
'Open the generated survey file under the object stored by wBook, set the page object in the open book
Set wBook = Application.Workbooks.Open(path)
It stop here and says the error is with the
VBA Code:
Set wBook = Application.Workbooks.Open(path)
The path is still the same "C:\Users\Remote\Desktop\GENERATED_LOGS"
I am confused
please help