I{m using a macro to open another xl save data and close it again.
After every use of hte macro the VBAproject of the other XL file remains open and I end up with many VBAprojects of the same file.
Seems the file is not totaly closed with the OpenedWB.close.........
Any idea how I can close also the VBA project everytime the file is opened en close in Excel?????
****************************************
Dim ActiveSh As Worksheet
Dim OpenedWb As Workbook
Dim strFname As String
Application.ScreenUpdating = False
If WorksheetFunction.CountA(Range("control1"), Range("cedula1")) = 6 Then
strFname = Range("ubicacion").Value
Set ActiveSh = ActiveSheet()
Set OpenedWb = Workbooks.Open(Filename:=strFname,
writeResPassword:=Sheet5.Range("password").Value)
With OpenedWb
.ActiveSheet.Range("A2").EntireRow.Insert
.ActiveSheet.Range("a22").Value = ActiveSh.Range
("guardar1").Value
OpenedWb.Close
Application.Goto Reference:="comienzo2"
End With
Else
If WorksheetFunction.CountA(Range("control1")) < 5 Then
Application.Goto Reference:="control1"
MsgBox "Llena todos los datos "
Else
Application.Goto Reference:="cedula1"
MsgBox "llena el numero de cedula "
End If
End If
Application.ScreenUpdating = True
End Sub
**************************************
Thanks for helping me out on this one!
Joke
After every use of hte macro the VBAproject of the other XL file remains open and I end up with many VBAprojects of the same file.
Seems the file is not totaly closed with the OpenedWB.close.........
Any idea how I can close also the VBA project everytime the file is opened en close in Excel?????
****************************************
Dim ActiveSh As Worksheet
Dim OpenedWb As Workbook
Dim strFname As String
Application.ScreenUpdating = False
If WorksheetFunction.CountA(Range("control1"), Range("cedula1")) = 6 Then
strFname = Range("ubicacion").Value
Set ActiveSh = ActiveSheet()
Set OpenedWb = Workbooks.Open(Filename:=strFname,
writeResPassword:=Sheet5.Range("password").Value)
With OpenedWb
.ActiveSheet.Range("A2").EntireRow.Insert
.ActiveSheet.Range("a22").Value = ActiveSh.Range
("guardar1").Value
OpenedWb.Close
Application.Goto Reference:="comienzo2"
End With
Else
If WorksheetFunction.CountA(Range("control1")) < 5 Then
Application.Goto Reference:="control1"
MsgBox "Llena todos los datos "
Else
Application.Goto Reference:="cedula1"
MsgBox "llena el numero de cedula "
End If
End If
Application.ScreenUpdating = True
End Sub
**************************************
Thanks for helping me out on this one!
Joke