Manejar Libros de excel desde macro en Outlook
Hola Foro: Estoy haciendo una macro en outlook, que maneja libros de excel. El tema es que al iniciar la macro necesito operar con libros de excel: 1. Conocer los libros abiertos. 2. Cerrar determinados libros preguntando si se quiere cerrar guardando o descartar cambios.
Por ejemplo:
If IsFileOpen("\\172.0.0.250\D-ip\0000\REGISTROPruebas.xlsm") Then
' Display a message stating the file in use.
MsgBox "El Fichero está en uso!"
' Add code here to handle case where file is open by another ' user.
Workbook.Close \\172.0.0.250\D-ip\0000\REGISTROPruebas.xlsm 'NO FUNCIONA
'Workbooks("RegistroPruebas.xlsm").Close 'savechanges:=False 'ESTA OTRA 'ALTERNATIVA TAMPOCO FUNCIONA
Else
' Display a message stating the file is not in use.
MsgBox "El Fichero NO está en uso!"
' Open the file in Microsoft Excel.
Workbooks.Open "\\172.0.0.250\D-ip\0000\REGISTROPruebas.xlsm" ' SIN EMBARGO EN EL 'CASO DE QUE EL LIBRO ESTE CERRADO, SI FUNCIÓN EST ORDEN
' Add code here to handle case where file is NOT open by another ' user. '
End If
Otro Ejemplo:
Worbooks.Close 'Esta orden no funciona.
Recuerdo que estoy en una macro de outlook.
Tengo activada la referencia "Microsoft Excel 14.0 Object Library"
También "Microsoft Office 14.0 Object Library"
Trabajo con Office 2010.
¿Podéis ayudarme?