Let's see who is strong.
A code that does not give errors but which does not modify not even one of the series of excel files (xlsx, Mac 2011) present in the same folder.
What is the problem?
about insertc
Many thanks
A code that does not give errors but which does not modify not even one of the series of excel files (xlsx, Mac 2011) present in the same folder.
What is the problem?
VBA Code:
Option Explicit
Sub Macro2()
Dim MyFiles As String
Dim MyPath As String
Dim FilesInPath As String
Dim Filename As String
Dim Fnum As Long
On Error Resume Next
MyFiles = MacScript("choose folder as string")
MyPath = MacScript("return posix path of (choose folder with prompt ""Select the folder"") as string")
If MyPath = "" Then Exit Sub
On Error GoTo 0
If Right(MyPath, 1) <> Application.PathSeparator Then
MyPath = MyPath & Application.PathSeparator
End If
FilesInPath = Dir(MyPath & "XLS#")
If FilesInPath = "" Then
MsgBox "No files found"
Exit Sub
End If
If Fnum > 0 Then
Filename = Dir(MyPath & "XLS#")
Do While Filename <> ""
Workbooks.Open ":" & MyFiles
MsgBox ActiveWorkbook.Name
insertc wb:=ActiveWorkbook
ActiveWorkbook.Close SaveChanges:=True
Loop
End If
End Sub
about insertc
Code:
Sub insertc(ByVal wb As Workbook)
wb.Range("A5").Value = "ca1"
wb.Range("A6").Value = "ca2"
End Sub
Many thanks