Hello All,
I have created a data cube which is created on batch every morning. Ideally this will need ot be a DB, but in the mean time I need to query this data set and drop it into a template of other reports.
I have created a query in MS Query, which I reference in VBA to extract to a point in my report. I have run this report succefully a few times. But i can't do this consitantly. It trips out at the line i have highlighted?
Any help would be a huge help.
Many Thanks
Craig
Sub Add_and_remove_connection()
'
' Add_and_remove_connection
With ActiveSheet.QueryTables.Add(Connection:= _
"FINDER;C:\Documents and Settings\Craig\Desktop\Reporting Suite\MS Query Example.dqy", _
Destination:=Range("A1"))
.Name = "Cube Data WorkTypeRemoved"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
'.RefreshStyle = xlInsertDeleteCells
.RefreshStyle = xlOverwriteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
End Sub
I have created a data cube which is created on batch every morning. Ideally this will need ot be a DB, but in the mean time I need to query this data set and drop it into a template of other reports.
I have created a query in MS Query, which I reference in VBA to extract to a point in my report. I have run this report succefully a few times. But i can't do this consitantly. It trips out at the line i have highlighted?
Any help would be a huge help.
Many Thanks
Craig
Sub Add_and_remove_connection()
'
' Add_and_remove_connection
With ActiveSheet.QueryTables.Add(Connection:= _
"FINDER;C:\Documents and Settings\Craig\Desktop\Reporting Suite\MS Query Example.dqy", _
Destination:=Range("A1"))
.Name = "Cube Data WorkTypeRemoved"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
'.RefreshStyle = xlInsertDeleteCells
.RefreshStyle = xlOverwriteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
End Sub
Last edited: