jazzyt2u
09-15-2008, 04:53 PM
Hi,
I am using the following code to open unknown files in a folder and process them.
Sub OpenFiles()
Const FOLDER_NAME As String = "C:\test\" '<===== change to suit
Dim NextFile As String
NextFile = Dir(FOLDER_NAME & "*.xls", vbNormal)
Do While NextFile <> ""
Workbooks.Open FOLDER_NAME & NextFile
' do stuff on active workbook
NextFile = Dir
Loop
End Sub
The files will have macros. How do I automatically enable the macro so the user doesn't have to take the time to click the enable macro button?
Thanks
I am using the following code to open unknown files in a folder and process them.
Sub OpenFiles()
Const FOLDER_NAME As String = "C:\test\" '<===== change to suit
Dim NextFile As String
NextFile = Dir(FOLDER_NAME & "*.xls", vbNormal)
Do While NextFile <> ""
Workbooks.Open FOLDER_NAME & NextFile
' do stuff on active workbook
NextFile = Dir
Loop
End Sub
The files will have macros. How do I automatically enable the macro so the user doesn't have to take the time to click the enable macro button?
Thanks