Llamar macro desde otra no funciona
Tengo la siguiente macro que sirve para guardar el libro en PDF
Sub CommandButton1_Click()
'GUARDA LAS HOJAS COMPLETAS PREVIAMENTE SELECCIONADAS
Dim hoja As Control
x = 0
For Each hoja In Me.Controls
If Not hoja.Name = "CommandButton1" Then
x = x + 1
If hoja.Value = True Then
Worksheets(hoja.Caption).PageSetup.LeftFooter = hoja.Caption
If a = 1 Then ren = "False" Else ren = "True"
Worksheets(hoja.Caption).Select Replace:=ren
a = 1
End If
End If
Next
On Error Resume Next
'nbre = "Prueba " & Format(Date, "dd-mm-yyyy" & " " & Format(Time(), "hh-mm-ss")) '"Prueba1" O TAMBIÉN:
'nbre = InputBox("Escribe el nombre con el que quieres guardar:", "Guardar archivo") & " " & Format(Date, "dd-mm-yyyy" & " " & Format(Time(), "hh-mm-ss"))
nbre = Trim(InputBox(" Registre un Nombre ")) & Format(Date, "dd-mm-yyyy" & " " & Format(Time(), "hh-mm-ss"))
Set wb = ActiveWorkbook
With wb
RutaArchivo = ThisWorkbook.Path & "\" & nbre & ".pdf" '<==================================Ruta archivo
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=RutaArchivo, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
'Sheets(1).Select
Unload Me
End With
End Sub
Private Sub marca_Click()
Dim check As Control
For Each check In Me.Controls
On Error Resume Next
If Not check.Name = "marca" And Not check.Name = "CommandButton1" Then
If check = True Then check = False: marca.Caption = "Marcar Todos" Else _
check = True: marca.Caption = "Desmarcar Todos"
End If
Next
Call deagruparhojass
End Sub
Private Sub UserForm_Activate()
Dim cCntrl As Control
Dim oSheet As Object
x = 60
For Each oSheet In Sheets
If oSheet.Visible = -1 Then
Set cCntrl = Me.Controls.Add("Forms.checkbox.1", , True)
With cCntrl
.Caption = oSheet.Name
.Width = Me.Width
.Height = 15
.Top = x
.Left = 18
.Value = True
End With
x = x + 15 'Separación entre cada item
End If
Next
Me.Height = x + 36
End Sub
la macro la llamo desde un modulo
Sub mostrarpdf()
Call UserForm2.Show
Call deagruparhojass
End Sub
Hasta ahí funciona todo perfecto pero ahora quiero que antes de ejecutar la macro, me oculte una columna de una hoja especifica y eso lo hago con la siguiente macro :
Sub oculta_columbime()
Sheets("Boletines Bimestrales").Range("AL1271").EntireColumn.Hidden = True
End Sub
La idea es que la columna se oculte antes de guardar el libro en PDF para que esa columna no salga en el PDF y luego se muestre al finalizar la generación del PDF
Sub mostrarpdf()
Call ocultarcolumbime
Call UserForm2.Show
call mostrarcoumbime
Call deagruparhojass
End Sub
Esa seria la idea pero el error que me da dice :
Se esperaba una variable o un procedimiento, no un modulo.