Necesito ayuda Urgente con una Macro

25/05/2006 - 23:13 por Zaito | Informe spam
Hola, ni nombre es Gonzalo

Estoy recién entrando al mundo de las macros

Necesito que me puedan oprientar con lo siguiente

Tengo los siguientes datos en una macro

Sub AjustarTablaInforme(
Range("A4").Selec
Selection.AutoFilte
Selection.AutoFilter Field:=1, Criteria1:="<>
ActiveWindow.SelectedSheets.PrintPrevie
End Su

Sub AjustarTablaInfMensual(
Range("A1").Selec
Selection.AutoFilte
Selection.AutoFilter Field:=1, Criteria1:="<>
ActiveWindow.SelectedSheets.PrintPrevie
End Su

Sub MostrarDataForm(
Hoja2.Selec
Range("N1:AA31").Selec
ActiveSheet.ShowDataFor
End Su

Sub CreateMenu(
Dim cbMenu As CommandBarControl, cbSubMenu As CommandBarContro
RemoveMenu ' delete the menu if it already exist
Set cbMenu = Application.CommandBars(1).Controls.Add(msoControlPopup, , , , True
With cbMen
.Caption = "&Remuneraciones
.Tag = "MyTag
.BeginGroup = Fals
End Wit
If cbMenu Is Nothing Then Exit Sub ' didn't find the menu..
With cbMenu.Controls.Add(msoControlButton, 1, , , True
.Caption = "&Información de los Empleados
.OnAction = "Empleados
.Style = msoButtonIconAndCaptio
.FaceId = 60
.State = msoButtonUp ' or msoButtonDow
End Wit
With cbMenu.Controls.Add(msoControlButton, 1, , , True
.Caption = "I&nformación Mensual
.OnAction = "InfoMensual
.Style = msoButtonIconAndCaptio
.FaceId = 46
.State = msoButtonUp ' or msoButtonDow
End Wit
With cbMenu.Controls.Add(msoControlButton, 1, , , True
.Caption = "&Tabla de AFP's
.OnAction = "CotAFP
.Style = msoButtonIconAndCaptio
.FaceId = 85
.State = msoButtonUp ' or msoButtonDow
End Wit
With cbMenu.Controls.Add(msoControlButton, 1, , , True
.Caption = "T&abla de ISAPRES
.OnAction = "ISAPRES
.Style = msoButtonIconAndCaptio
.FaceId = 85
.State = msoButtonUp ' or msoButtonDow
End Wit
With cbMenu.Controls.Add(msoControlButton, 1, , , True
.Caption = "In&formación de la Empresa
.OnAction = "InfoEmpresa
.Style = msoButtonIconAndCaptio
.FaceId = 101
.State = msoButtonUp ' or msoButtonDow
End Wit
Set cbSubMenu = cbMenu.Controls.Add(msoControlPopup, 1, , , True
With cbSubMen
.Caption = "Im&primir
.Tag = "SubMenu1
.BeginGroup = Tru
End Wit
With cbSubMenu.Controls.Add(msoControlButton, 1, , , True
.Caption = "Informe &Resumen
.OnAction = "InfoResumen
.Style = msoButtonIconAndCaptio
.FaceId =
.State = msoButtonUp ' or msoButtonDow
End Wit
With cbSubMenu.Controls.Add(msoControlButton, 1, , , True
.Caption = "&Liquidaciones de Sueldo
.OnAction = "LiqSueldos
.Style = msoButtonIconAndCaptio
.FaceId = 197
.State = msoButtonUp ' or msoButtonDow
End Wit
With cbSubMenu.Controls.Add(msoControlButton, 1, , , True
.Caption = "&Planilla de Remuneraciones
.OnAction = "PlanillaRemu
.Style = msoButtonIconAndCaptio
.FaceId =
.State = msoButtonUp ' or msoButtonDow
End Wit
With cbSubMenu.Controls.Add(msoControlButton, 1, , , True
.Caption = "&Cotizaciones AFP's e ISAPRES
.OnAction = "ImprimirAFPISAPRE
.Style = msoButtonIconAndCaptio
.FaceId = 85
.State = msoButtonUp ' or msoButtonDow
End Wit
Set cbSubMenu = cbMenu.Controls.Add(msoControlPopup, 1, , , True
With cbSubMen
.Caption = "Base de Datos
.Tag = "SubMenu2
.BeginGroup = Tru
End Wit
With cbSubMenu.Controls.Add(msoControlButton, 1, , , True
.Caption = "Grabar Datos del Mes
.OnAction = "GrabarDatos
.Style = msoButtonIconAndCaptio
.FaceId = 190
.State = msoButtonUp ' or msoButtonDow
End Wit
With cbSubMenu.Controls.Add(msoControlButton, 1, , , True
.Caption = "Recuperar Datos"
.OnAction = "RecuperarDatos"
.Style = msoButtonIconAndCaption
.FaceId = 1900
.State = msoButtonUp ' or msoButtonDown
End With
Set cbSubMenu = Nothing
Set cbMenu = Nothing
End Sub

Sub RemoveMenu()
DeleteCustomCommandBarControl "MyTag" ' deletes the new menu
End Sub

Private Sub DeleteCustomCommandBarControl(CustomControlTag As String)
On Error Resume Next
Do
Application.CommandBars.FindControl(, , CustomControlTag, False).Delete
Loop Until Application.CommandBars.FindControl(, , CustomControlTag, False) Is Nothing
On Error GoTo 0
End Sub

Sub ShowHideMenu(MenuVisible As Boolean)
ChangeControlVisibility "MyTag", MenuVisible ' toggles menu visibility
End Sub

Private Sub ChangeControlVisibility(CustomControlTag As String, MenuVisible As Boolean)
On Error Resume Next
Application.CommandBars.FindControl(, , CustomControlTag, False).Visible = MenuVisible
On Error GoTo 0
End Sub

Sub Empleados()
UserForm1.Show
End Sub

Sub InfoResumen()
Application.ScreenUpdating = False
SelAFP
Sheets("Informe").Select
AjustarTablaInforme
Sheets("Sueldos").Select
Range("G19").Select
End Sub

Sub LiqSueldos()
SelAFP
ImprimirLiqSueldo
Sheets("Sueldos").Select
Range("G19").Select
End Sub

Sub InfoMensual()
Application.ScreenUpdating = False
Hoja2.Select
ActiveSheet.ShowDataForm
SelAFP
Sheets("Sueldos").Select
Range("G19").Select
End Sub

Sub CotAFP()
Application.ScreenUpdating = False
Sheets("AFP").Select
ActiveSheet.ShowDataForm
Sheets("Sueldos").Select
Range("G19").Select
End Sub

Sub PlanillaRemu()
SelAFP
ImprimirPlanRemu
Sheets("Sueldos").Select
Range("G19").Select
End Sub

Sub ImprimirAFPISAPRE()
SelAFP
ImprimirISAPRE
ImprimirAFP
Sheets("Sueldos").Select
Range("G19").Select
End Sub

Sub InfoEmpresa()
Application.ScreenUpdating = False
Sheets("Datos Empresa").Select
ActiveSheet.ShowDataForm
Sheets("Sueldos").Select
Range("G19").Select
End Sub

Sub ISAPRES()
Application.ScreenUpdating = False
Sheets("ISAPRE").Select
ActiveSheet.ShowDataForm
Sheets("Sueldos").Select
Range("G19").Select
End Sub

Todos los datos me funcionan bien con esta planilla.

Con esto se me activa este menú

Forms.CommandButton.1";""

Lo que necesito es que cambiar los colores de los botones, de las etiquetas, del texto de las etiquetas, del fondo y del scrollbar por otros que no sean los del sistema.

Agradeciendo desde ya la ayuda.

Atentamente:

Gonzalo


Zaito


Ver este tema: http://www.softwaremix.net/viewtopic-518946.html

Enviado desde http://www.softwaremix.net
 

Leer las respuestas

#1 Héctor Miguel
26/05/2006 - 19:46 | Informe spam
hola, Gonzalo !

Estoy recien entrando al mundo de las macros.
Necesito que me puedan oprientar con lo siguiente: [...]
... necesito... cambiar los colores de los botones, de las etiquetas, del texto de las etiquetas, del fondo y del scrollbar
por otros que no sean los del sistema.



no resulta muy claro 'a que objetos' quieres cambiarles la apariencia -?- [en via de mientras]...

1) los colores, fuentes y demas caracteristicas de los elementos graficos de las apllicaciones en windows...
son 'controlados' por el panel de control de windows desde las propiedades de la pantalla [seccion apariencia]

2) puedes tambien aplicar 'temas de escritorio' [mismo panel de control de windows]

3) algunas caracteristicas 'controlan a otras [p.e.]...
los puntos del elemento 'barras de desplazamiento' afectan el tama#o de los textos/etiquetas de las hojas en excel :))

4) si usas la caracteristica del color de las etiquetas en excel [xp o 2003]...
perderias dichos cambios en versiones anteriores [no tienen soporte para las caracteisticas 'nuevas']

los puntos anteriores podrian 'alterar' los elementos graficos modificados -> para todas las aplicaciones bajo windows ;)

comentas [si hubiera] algun detalle adicional ?
saludos,
hector.

__ el resto del mensaje [codigos utilizados] __
Tengo los siguientes datos en una macro:
Sub AjustarTablaInforme()
Range("A4").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="<>"
ActiveWindow.SelectedSheets.PrintPreview
End Sub
Sub AjustarTablaInfMensual()
Range("A1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="<>"
ActiveWindow.SelectedSheets.PrintPreview
End Sub
Sub MostrarDataForm()
Hoja2.Select
Range("N1:AA31").Select
ActiveSheet.ShowDataForm
End Sub
Sub CreateMenu()
Dim cbMenu As CommandBarControl, cbSubMenu As CommandBarControl
RemoveMenu ' delete the menu if it already exists
Set cbMenu = Application.CommandBars(1).Controls.Add(msoControlPopup, , , , True)
With cbMenu
.Caption = "&Remuneraciones"
.Tag = "MyTag"
.BeginGroup = False
End With
If cbMenu Is Nothing Then Exit Sub ' didn't find the menu...
With cbMenu.Controls.Add(msoControlButton, 1, , , True)
.Caption = "&Información de los Empleados"
.OnAction = "Empleados"
.Style = msoButtonIconAndCaption
.FaceId = 607
.State = msoButtonUp ' or msoButtonDown
End With
With cbMenu.Controls.Add(msoControlButton, 1, , , True)
.Caption = "I&nformación Mensual"
.OnAction = "InfoMensual"
.Style = msoButtonIconAndCaption
.FaceId = 463
.State = msoButtonUp ' or msoButtonDown
End With
With cbMenu.Controls.Add(msoControlButton, 1, , , True)
.Caption = "&Tabla de AFP's"
.OnAction = "CotAFP"
.Style = msoButtonIconAndCaption
.FaceId = 852
.State = msoButtonUp ' or msoButtonDown
End With
With cbMenu.Controls.Add(msoControlButton, 1, , , True)
.Caption = "T&abla de ISAPRES"
.OnAction = "ISAPRES"
.Style = msoButtonIconAndCaption
.FaceId = 852
.State = msoButtonUp ' or msoButtonDown
End With
With cbMenu.Controls.Add(msoControlButton, 1, , , True)
.Caption = "In&formación de la Empresa"
.OnAction = "InfoEmpresa"
.Style = msoButtonIconAndCaption
.FaceId = 1016
.State = msoButtonUp ' or msoButtonDown
End With
Set cbSubMenu = cbMenu.Controls.Add(msoControlPopup, 1, , , True)
With cbSubMenu
.Caption = "Im&primir"
.Tag = "SubMenu1"
.BeginGroup = True
End With
With cbSubMenu.Controls.Add(msoControlButton, 1, , , True)
.Caption = "Informe &Resumen"
.OnAction = "InfoResumen"
.Style = msoButtonIconAndCaption
.FaceId = 7
.State = msoButtonUp ' or msoButtonDown
End With
With cbSubMenu.Controls.Add(msoControlButton, 1, , , True)
.Caption = "&Liquidaciones de Sueldo"
.OnAction = "LiqSueldos"
.Style = msoButtonIconAndCaption
.FaceId = 1978
.State = msoButtonUp ' or msoButtonDown
End With
With cbSubMenu.Controls.Add(msoControlButton, 1, , , True)
.Caption = "&Planilla de Remuneraciones"
.OnAction = "PlanillaRemu"
.Style = msoButtonIconAndCaption
.FaceId = 7
.State = msoButtonUp ' or msoButtonDown
End With
With cbSubMenu.Controls.Add(msoControlButton, 1, , , True)
.Caption = "&Cotizaciones AFP's e ISAPRES"
.OnAction = "ImprimirAFPISAPRE"
.Style = msoButtonIconAndCaption
.FaceId = 852
.State = msoButtonUp ' or msoButtonDown
End With
Set cbSubMenu = cbMenu.Controls.Add(msoControlPopup, 1, , , True)
With cbSubMenu
.Caption = "Base de Datos"
.Tag = "SubMenu2"
.BeginGroup = True
End With
With cbSubMenu.Controls.Add(msoControlButton, 1, , , True)
.Caption = "Grabar Datos del Mes"
.OnAction = "GrabarDatos"
.Style = msoButtonIconAndCaption
.FaceId = 1900
.State = msoButtonUp ' or msoButtonDown
End With
With cbSubMenu.Controls.Add(msoControlButton, 1, , , True)
.Caption = "Recuperar Datos"
.OnAction = "RecuperarDatos"
.Style = msoButtonIconAndCaption
.FaceId = 1900
.State = msoButtonUp ' or msoButtonDown
End With
Set cbSubMenu = Nothing
Set cbMenu = Nothing
End Sub
Sub RemoveMenu()
DeleteCustomCommandBarControl "MyTag" ' deletes the new menu
End Sub
Private Sub DeleteCustomCommandBarControl(CustomControlTag As String)
On Error Resume Next
Do
Application.CommandBars.FindControl(, , CustomControlTag, False).Delete
Loop Until Application.CommandBars.FindControl(, , CustomControlTag, False) Is Nothing
On Error GoTo 0
End Sub
Sub ShowHideMenu(MenuVisible As Boolean)
ChangeControlVisibility "MyTag", MenuVisible ' toggles menu visibility
End Sub
Private Sub ChangeControlVisibility(CustomControlTag As String, MenuVisible As Boolean)
On Error Resume Next
Application.CommandBars.FindControl(, , CustomControlTag, False).Visible = MenuVisible
On Error GoTo 0
End Sub
Sub Empleados()
UserForm1.Show
End Sub
Sub InfoResumen()
Application.ScreenUpdating = False
SelAFP
Sheets("Informe").Select
AjustarTablaInforme
Sheets("Sueldos").Select
Range("G19").Select
End Sub
Sub LiqSueldos()
SelAFP
ImprimirLiqSueldo
Sheets("Sueldos").Select
Range("G19").Select
End Sub
Sub InfoMensual()
Application.ScreenUpdating = False
Hoja2.Select
ActiveSheet.ShowDataForm
SelAFP
Sheets("Sueldos").Select
Range("G19").Select
End Sub
Sub CotAFP()
Application.ScreenUpdating = False
Sheets("AFP").Select
ActiveSheet.ShowDataForm
Sheets("Sueldos").Select
Range("G19").Select
End Sub
Sub PlanillaRemu()
SelAFP
ImprimirPlanRemu
Sheets("Sueldos").Select
Range("G19").Select
End Sub
Sub ImprimirAFPISAPRE()
SelAFP
ImprimirISAPRE
ImprimirAFP
Sheets("Sueldos").Select
Range("G19").Select
End Sub
Sub InfoEmpresa()
Application.ScreenUpdating = False
Sheets("Datos Empresa").Select
ActiveSheet.ShowDataForm
Sheets("Sueldos").Select
Range("G19").Select
End Sub
Sub ISAPRES()
Application.ScreenUpdating = False
Sheets("ISAPRE").Select
ActiveSheet.ShowDataForm
Sheets("Sueldos").Select
Range("G19").Select
End Sub

Preguntas similares