Saltar al contenido
View in the app

A better way to browse. Learn more.

Ayuda Excel

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Macro para guardar archvio

publicado

Tengo esta Macro que guarda la hoja, pero quiero que lo haga igual para todo el Libro.

Muchas Gracias

Option Explicit

'

Sub EXCELeINFOGuardarHojaComoArchivoNuevo()

'

Dim VentanasProtegidas As Boolean

Dim EstructuraProtegida As Boolean

Dim NombreHoja As String

Dim Confirmacion As String

Dim NombreArchivo As String

Dim GuardarComo As Variant

Dim Extension As String

'

On Error GoTo ErrorHandler

'

VentanasProtegidas = ActiveWorkbook.ProtectWindows

EstructuraProtegida = ActiveWorkbook.ProtectStructure

'

If VentanasProtegidas = True Or EstructuraProtegida = True Then

MsgBox "No se puede ejecutar el comando cuando la estructura del archivo está protegida.", _

vbExclamation, "EXCELeINFO"

Else

'

NombreHoja = ActiveSheet.Name

Confirmacion = MsgBox("Desea guardar la hoja '" & NombreHoja & "' como archivo nuevo?", _

vbQuestion + vbYesNo, "EXCELeINFO")

Application.ScreenUpdating = False

If Confirmacion = vbYes Then

ActiveSheet.Select

ActiveSheet.Copy

NombreArchivo = ActiveWorkbook.Name

GuardarComo = Application.GetSaveAsFilename(InitialFileName:=NombreHoja, _

fileFilter:="Libro de Excel(*.xlsx), *.xlsx, Libro de Excel habilitado para macros(*.xlsm), *.xlsm, Libro de Excel 97-2003(*.xls), *.xls,CSV (delimitado por comas)(*.csv),*.csv", _

Title:="EXCELeINFO - guadar hoja activa como archivo nuevo.")

If GuardarComo = False Then

Workbooks(NombreArchivo).Close SaveChanges:=False

Else

With Application.WorksheetFunction

Extension = .Trim(Right(.Substitute(GuardarComo, ".", .Rept(" ", 500)), 500))

End With

Select Case Extension

Case Is = "xlsx"

ActiveWorkbook.SaveAs GuardarComo

Case Is = "xlsm"

ActiveWorkbook.SaveAs GuardarComo, xlOpenXMLWorkbookMacroEnabled

Case Is = "xls"

ActiveWorkbook.SaveAs GuardarComo, xlExcel8

Case Is = "csv"

ActiveWorkbook.SaveAs GuardarComo, xlCSV

Case Else

ActiveWorkbook.SaveAs GuardarComo

End Select

End If

Else

End If

'

End If

'

Exit Sub

'

ErrorHandler:

MsgBox "Ha ocurrido un error: " & Err.Description, vbExclamation, "EXCELeINFO"

Workbooks(NombreArchivo).Close SaveChanges:=False

'

End Sub

Featured Replies

No hay posts para mostrar

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.