I have MS Access queries and forms tied to those queries. The forms
are set to be viewable only as PivotCharts. These work fantastic and
are very helpful. The problem is that they are so fantastic that
upper mgmt and clients are asking to receive a bundled report via
email containing about 15-20 of these Pivotcharts.
I cannot figure out how to get these pivotcharts out of MS access
while maintaining the pivotchart formatting - other than taking
screenshots one at a time and pasting into word or similar!
I know access fairly well. I don't know VBA at all. I found the
"answer" to this problem here:
http://office.microsoft.com/en-us/assistance/HA010345791033.aspx
I registered the dll it referenced. It says to use this code:
Me.ChartSpace.ExportPicture "C:yourdirectoryfilename.gif", , 1024,
1024
Great - how do I do that?
My Pivotcharts are named "frm_dashboard1" through "frm_dashboard20".
So - the answer must provide detailed instructions:
1)how do I set up my access db to output these 20 pivotchart forms as
GIF, BMP, JPEG, pdf, anything that retains the formatting.
2)This must be done in a way that can be automated
3) details on the automation (macro, whatever) included.
Brettola,
1. Create a new Form.
2. Put a button on it.
3. Paste the following into the button's Click event. Note that no
lines should wrap. The Answer box may wrap lines.
*** NOTE: There is a line marked in the code which you should change
to a directory that exists on your computer. ****
' -----------------------------
Dim frm As Form
Dim cht As ChartSpace
Dim strForm As String
Dim strFile As String
Dim iLoop As Integer
Dim strDir As String
' Change this line to the directory where you want your pictures.
' Make sure you keep the trailing slash
strDir = "D:JobsGooglePivotChart"
For iLoop = 1 To 20
strForm = "frm_dashboard" & CStr(iLoop)
strFile = "dashboard" & CStr(iLoop) & ".gif"
DoCmd.OpenForm strForm, acFormPivotChart
Set frm = Application.Forms(strForm)
Set cht = frm.ChartSpace
cht.ExportPicture strDir & strFile, , 1024, 1024
DoCmd.Close acForm, strForm
Next iLoop
' -----------------------------
4. You may not have to create reference to the dll you mention above
at this point, because you say already have. If you have not, you will
need to do so.
5. Save the Form.
Now, when you click the button, it should create your gifs. You can
then attach the gifs to an email or whatever you need to do with them.
Good luck with your Access project!
- Hammer
Search strategy
---------------
Read article provided by customer. Created Access database and wrote/tested code
per customer specifications.
Where's The Advantage In Windows Genuine Advantage?
Stocks Bounce After S&P Joins Bear Market |