vb Print and Save Charts (urgent)!!

Posted on 2003-02-18
Medium Priority
Last Modified: 2010-04-07
Here are my questions :

i create a chart :

Set cmdObject = Form2.Controls.Add("MSChart20Lib.MSChart", "achart" + Trim(Str(n)))

thats not a problem
i work with it a bit
now i need this :

1- i wanna be able to prints those charts
2- i need to save those charts in a .doc or .txt

is this possible

for the Print, what i have now, is i create it on an other form, print and then clear evrytime, but i wanna know if there is an other way

i really need help
Question by:Italbro4
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Expert Comment

ID: 7979096
Hi Italbro

Try to make this:
on your form Declare

Dim F
Dim Filename

sub commandPrint()
Filename = Index you Chart name
printer.currentX = 1000
Printer.currentY = 3000
printer.print Filename
end sub

Does'nt print colors to do so you need to convert to bitmap or print with Crystal Report.

Sub commandSave()
FileName = Index your Chart name
F = Free file
Open "Chart.dat" for Output as #F
Print #f,Filename
Close #f
end sub

I 'm Not sure if you ned to save it in binary file, depends on your chart.
To Load Chart.dat use:

Sub CommandOpen()
F=Free File
Open "Chart.dat" for input as F
Filename = Input(LOF(F),F)
Close F

Good Luck

Author Comment

ID: 7980978
i'll try this later
but the CommandSave and COmmandOpen

i'm not to sure i understand

I just need to create a new .doc and save the chart there
so i open the file, save in it
and close it
why u doing 2 step for it

Author Comment

ID: 7981358

it dosent really work

FileName = Index your Chart name // gives me an error

it creates the file
i need a .doc

u think u can make it work

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.


Author Comment

ID: 8007978
can i get my points back, cause i didnt get any good answer
LVL 18

Expert Comment

ID: 8008501
Leave a question for 0 points at Community Support link for deletion of question

Accepted Solution

JoaTex earned 400 total points
ID: 8013455
Hi Italbro4
Sorry By the delay of your problem, but sometimes i do not enought time to resolve ans understand some problems. But i Never Quick before say something.
put a picture box on a form, name it as Picture1
4 CommonButtons
Command1 will be to draw your Graph
Command 2 Will Print your Graph, You'll Have control on Paper position and Graph Size
Command 3 Will put your Graph as Bitmap in memory to use it on any Design Program or photo Program as PaintShop Etc.
Command4 Will save your graph on your project Directiry as a Bitmap.

Dim x, y, N
Dim A, B

Private Sub Command2_Click()
x = 1000    'Printer Position
y = 1000
A = 750     'Size Graphic
B = 750
Printer.PaintPicture Picture1.Image, x, y, A, B
End Sub

Private Sub Command1_Click()
   x = Picture1.ScaleWidth / 2
   y = Picture1.ScaleHeight / 2
   For N = 1 To 10
      Picture1.Circle (x, y), N * 50, RGB(N * 8, N * 15, N * 12)
   Next N
End Sub

Private Sub Command3_Click()
   Clipboard.SetData Picture1.Image, vbCFBitmap
End Sub

Private Sub Command4_Click()
   SavePicture Picture1.Image, App.Path & "\TEST.BMP"
End Sub

I Hope this is what you want.

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month8 days, 20 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question