Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, I have the following code in to run a query from a button and this works
great - except for the fact that instead of replacing existing data it places the new data beside it - moving along the columns each time. Please can someone help point out where I have gone wrong. Private Sub CommandButton1_Click() Dim strConnection As String Dim strFullFileName As String, strFolder As String Dim strQueryName As String strQueryName = "Pest-Invoice Due" strFolder = "U:\" strFullFileName = _ strFolder & strQueryName & ".dqy" strConnection = "FINDER;" & strFullFileName With ActiveSheet.QueryTables.Add( _ Connection:=strConnection, _ Destination:=Range("A7")) .Name = strQueryName .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = True .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .PreserveColumnInfo = True .Refresh BackgroundQuery:=False End With End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
replaces formula to its value | Excel Worksheet Functions | |||
Microsoft Query sometimes adds trailing spaces to fields | Excel Discussion (Misc queries) | |||
VBA replaces formula but adds row in multiplier | Excel Programming | |||
Multiple Edit Replaces | Excel Programming | |||
Multiple Edit Replaces | Excel Programming |