I am using this code to get me to a path then I click on the file I want and it opens it and makes it a .csv file. Then my code does stuff with it and closes it. My question is, do I even have to click on it? Can I get the macro to automatically open the file. Note the "NewestFolderInThePath" is a function that open me up to the "newest" created folder in the path. From there I double click file.
Code:
NewestFolderInThePath = ReturnNewestFolder("\\datawhse\root\LAW81\LAWSON\print\RBLEVINS2\anrvwfins\1\")
Path = "\\datawhse\root\LAW81\LAWSON\print\RBLEVINS2\anrvwfins\1\"
TheFile = Path & NewestFolderInThePath
CreateObject("WScript.Shell").CurrentDirectory = TheFile
TheFile = Application.GetOpenFilename("Excel Files (*.*), *.*", , "Open Balance Sheet File FRPMBSDTL")
If TheFile = "False" Then
continue = MsgBox("Do you want to Continue to IS Download?", _
vbInformation + vbYesNo, _
"Continue?")
If continue = 6 Then GoTo IncSt
If continue = 7 Then Exit Sub
End If
Oldfilename = TheFile
' Separate the file path and file name
BS = InStrRev(Oldfilename, "\")
Oldfilepath = Left(Oldfilename, BS)
Newfilename = Right(Oldfilename, Len(Oldfilename) - BS)
' Add the CSV extension to the file name
Dot = InStr(1, Newfilename, ".")
Newfilename = Oldfilepath & Left(Newfilename, Dot) & "csv"
' Rename the file
Name Oldfilename As Newfilename
Workbooks.Open Filename:=Newfilename
Set OpenA = Workbooks(Workbooks.Count)