-
Problem With Macro
Hi,
below my Macro:
Code:
Sub AllFiles()
Dim folderPath As String
Dim filename As String
Dim wb As Workbook
folderPath = "C:\Users\Dom\Desktop\Bob"
If Right(folderPath, 1) <> "\" Then folderPath = folderPath + "\"
filename = Dir(folderPath & "*.csv")
Do While filename <> ""
Application.ScreenUpdating = False
Set wb = Workbooks.Open(folderPath, Local:=True & filename)
Call ChangeFile
filename = Dir
Loop
Application.ScreenUpdating = True
End Sub
I need to open CSV file with data like Excel, so I wrote Local:=True, but then i have error:"run time error 1004 method open of object workbooks failed"
Any help is greatly appreciated!!
-
Code:
If Right(folderPath, 1) <> "\" Then folderPath = folderPath & "\"
Note the "&" HTH. Dave
edit: Welcome to this forum!
-
Yes, welcome to the forum
I added CODE tags around your macro for formatting, but the next time you can use the [#] icon to insert the CODE and /CODE tags and paste your macro(s) between them
-
Thank you I found solution.