Visual Basic para Aplicaciones - Macro para abrir libro de excel desde un botón de comando

Life is soft - evento anual de software empresarial
 
Vista:
sin imagen de perfil

Macro para abrir libro de excel desde un botón de comando

Publicado por Maria (7 intervenciones) el 22/06/2017 17:25:28
Hola amigos!

Es posible abrir un libro de excel con macros desde un botón de comando de otro libro?

Me ayudarían con el código por favor?

Gracias.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Macro para abrir libro de excel desde un botón de comando

Publicado por JuanC (565 intervenciones) el 23/06/2017 17:01:45
este pequeño código abre libros... (adaptalo según tu necesidad)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'//By JuanC - Feb. 2014
 
Sub test()
Dim wbk As Excel.Workbook, ws As Excel.Worksheet
Dim sPath$, sName$, sXL$
 
Application.ScreenUpdating = False
 
sPath = ActiveWorkbook.Path
sName = ActiveWorkbook.Name
 
sXL = VBA.Dir(sPath & "\*.xls")
 
Do While sXL <> ""
   If sXL <> sName Then
      Set wbk = Workbooks.Open(Filename:=sPath & "\" & sXL)
      'For Each ws In wbk.Sheets
      '    ws.Unprotect "password"
      'Next
      wbk.Unprotect "password"
      wbk.Save
      wbk.Close
   End If
   sXL = Dir
Loop
 
Application.ScreenUpdating = True
Set wbk = Nothing
Set ws = Nothing
End Sub
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar