D
Diddy
Hi everyone,
I'm at that stage where I'm probably a bit dangerous. I've recorded macros
and played with them, copied the lovely code from websites and played with it
etc.
Can I say thank you to Ron de Bruin for his code from MergeExamples which is
fantastic; does exactly what I want but loses me completely when I try to
work out what it does.
I'm using RDB_Copy_Sheet in the "Get_Sheet_Macro" module
http://www.rondebruin.nl/fso.htm with Excel 2003 but I think I need to
unprotect the sheets in the books in the source folder.
So, I tried reusing the bit of code that browses for the folder and adding a
do while loop but get a runtime error 13 type mismatch
Here's the code (I'm not adding RDB function that is in another module)
- so embarrassing to put this - shows exactly how much I don't understand
Sub unprotectshts()
'copied from RDB
Dim myFiles As Variant
Dim myCountOfFiles As Long
Dim oApp As Object
Dim oFolder As Variant
Set oApp = CreateObject("Shell.Application")
'Browse to the folder
Set oFolder = oApp.BrowseForFolder(0, "Select folder", 512)
If Not oFolder Is Nothing Then
myCountOfFiles = Get_File_Names( _
MyPath:=oFolder.Self.Path, _
Subfolders:=False, _
ExtStr:="*.xl*", _
myReturnedFiles:=myFiles)
End If
If myCountOfFiles = 0 Then
MsgBox "No files that match the ExtStr in this folder"
Exit Sub
End If
'End of copied from RDB
Do While myCountOfFiles <> 0
' Trying to get it to display a message box
'that will show sub looping though folders
'will change for unprotect sheets bit if I ever get this to work
MsgBox MyPath
Loop
End Sub
If anyone can help me that would be great
Thanks
I'm at that stage where I'm probably a bit dangerous. I've recorded macros
and played with them, copied the lovely code from websites and played with it
etc.
Can I say thank you to Ron de Bruin for his code from MergeExamples which is
fantastic; does exactly what I want but loses me completely when I try to
work out what it does.
I'm using RDB_Copy_Sheet in the "Get_Sheet_Macro" module
http://www.rondebruin.nl/fso.htm with Excel 2003 but I think I need to
unprotect the sheets in the books in the source folder.
So, I tried reusing the bit of code that browses for the folder and adding a
do while loop but get a runtime error 13 type mismatch
Here's the code (I'm not adding RDB function that is in another module)
- so embarrassing to put this - shows exactly how much I don't understand
Sub unprotectshts()
'copied from RDB
Dim myFiles As Variant
Dim myCountOfFiles As Long
Dim oApp As Object
Dim oFolder As Variant
Set oApp = CreateObject("Shell.Application")
'Browse to the folder
Set oFolder = oApp.BrowseForFolder(0, "Select folder", 512)
If Not oFolder Is Nothing Then
myCountOfFiles = Get_File_Names( _
MyPath:=oFolder.Self.Path, _
Subfolders:=False, _
ExtStr:="*.xl*", _
myReturnedFiles:=myFiles)
End If
If myCountOfFiles = 0 Then
MsgBox "No files that match the ExtStr in this folder"
Exit Sub
End If
'End of copied from RDB
Do While myCountOfFiles <> 0
' Trying to get it to display a message box
'that will show sub looping though folders
'will change for unprotect sheets bit if I ever get this to work
MsgBox MyPath
Loop
End Sub
If anyone can help me that would be great
Thanks