-
Finally 95% Working, Final Push To Generate Excel on The Fly
So got the whole date increment working, in a rather simplistic fashion but I think it will work... will need to test with lots of data but really don't think it would make a huge kind of difference... I guess the more complicated version would to check when SampleDate changes at which stage i would become 0 again.. not sure how to do that...
Now looking at generating that illusive graph on the fly...
I guess 2 questions:
1) How best to copy data to the Data sheet in the Excel with tblDataExport records..
2) And then set Series, X and Y Values.. I have setup all the preps in the code below.. apart from copy/pasting...
Cheers
Mike
[vba]Private Sub cmdSendExcel_Click()
Dim appExcel As Excel.Application
Dim wBook As Workbook
Set appExcel = New Excel.Application
appExcel.Visible = True
Set wBook = appExcel.Workbooks.Add
With wBook
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "Data"
.Application.DisplayAlerts = False
Sheets("Sheet2").Select
ActiveWindow.SelectedSheets.Delete
Sheets("Sheet3").Select
ActiveWindow.SelectedSheets.Delete
.Application.DisplayAlerts = True
.Charts.Add
.ActiveChart.ChartType = xlXYScatter
.ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="Graph"
.Application.ActiveWindow.Zoom = 100
.ActiveChart.ChartArea.Select
' .ActiveChart.SeriesCollection.NewSeries
' .ActiveChart.SeriesCollection(1).XValues = "=Data!$A$2:$A$5"
' .ActiveChart.SeriesCollection(1).YValues = "=Data!$B$2:$B$5"
' .ActiveChart.SeriesCollection(1).Name = "=Data!$B$1"
End With
'wBook.SaveAs
'appExcel.Quit
'Set appExcel = Nothing
End Sub[/vba]
-
Won't manually setting up one or more workbooks and then Linking them to the Query work, rather than trying to set them up on the fly?
I don't have any experience of working with Excel Graphs from Access, but a search on this forum may show some previous Threads on it, or possibly on the Excel Forum or possibly the Knowledge Base.
-
The immediate problem is really copying the query to Excel. The way you did Copy Paste as link is rather special way.. I can't seem to find any way of doing query copy.. paste as link in Excel is obvious.
Otherwise exporting query to Excel doesn't quite give you the desired results.
-
Maybe I should stick with manual
Last edited by itipu; 03-30-2010 at 01:57 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules