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.

Conexion SQL desde Excel para ejecutar consulta y traer resultados

publicado

Buenas Tardes

Tengo un problema con una macro que cree para ejecutar una consulta desde excel y que traiga los resultados en una celda en particular.

Hace meses la vengo usando y funcionaba perfecto, pero desde la semana pasada me tira este error:

RUN TIMER ERROR 1004 Application defined or objet defined error

y se tilda la siguiente sentencia

.Refresh BackgroundQuery:=False

Llevo toda una semana investigando que puede ser y no encuentro nada. Agradezco su ayuda *******!!!!

Dim varSQL

' OBTIENE EL NUMERO SIGUIENTE DE BASE

varSQL = Sheets("ArmadoQuery").Range("c23")

Sheets("Resultado").Select

Range("F15").Select

Selection.ClearContents

With ActiveSheet.QueryTables.Add(Connection:= _

"ODBC;DRIVER=SQL Server;SERVER=XXXXX;UID=XXXX;pwd=XXXX;DATABASE=XXXXX" _

, Destination:=Range("F15"))

.CommandText = varSQL

.Name = "Query from bi en bi01"

.FieldNames = False

.RowNumbers = False

.FillAdjacentFormulas = False

.PreserveFormatting = True

.RefreshOnFileOpen = False

.BackgroundQuery = True

.RefreshStyle = xlOverwriteCells

.SavePassword = False

.SaveData = True

.AdjustColumnWidth = False

.RefreshPeriod = 0

.PreserveColumnInfo = True

.Refresh BackgroundQuery:=False

Do While .Refreshing

DoEvents

Loop

End With

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.