ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel VBA Conversion (https://www.excelbanter.com/excel-programming/274809-excel-vba-conversion.html)

sheela

Excel VBA Conversion
 
Hello,

I'm working on an excel VBA macro where when I click on
the macro button on the spreadsheet, it should open the
chart (from another linked excel file)in html format.

Actually this excel program was created in excel 95 by
someone. I want to use it in Excel 2000/2002. The chart
was saved in a GIF format using a third party software
(Paint Shop) and then was copied to Word or directly
converted to html format.

__________________________________________________ ________

Sub SaveLPGCP()
OriginalState = ActiveWindow.WindowState
ActiveWindow.WindowState = xlNormal
Application.Calculation = xlAutomatic

Workbooks.Open HtmlPath & "LPG.XLS"
SavePicture ChartName:="Graph", SaveName:="LPG-CP.HTM"
Workbooks("LPG.XLS").Close saveChanges:=False
End Sub
__________________________________________________ ________

Sub SavePicture(ChartName, SaveName)
CopyPicture (ChartName)
x = Shell(ToolPath & "PSP.EXE", 1)
SendKeys "{TAB}~", True
SendKeys "^v~", True
SendKeys "%cd1", True
SendKeys "%p%n~", True
Application.Wait Now + TimeValue("00:00:" &
Application.Fixed(WaitState,
0))
SendKeys "%fx", True
SendKeys "y", True
SendKeys "%tg%n", True
SendKeys SavePath, True
SendKeys SaveName, True
SendKeys "~~", True
Application.Wait Now + TimeValue("00:00:" &
Application.Fixed(1.5 * WaitState, 0)) End Sub
__________________________________________________ ________

Sub CopyPicture(ChartName)
With ActiveWindow
.WindowState = xlNormal
.Width = SizeW
.Height = SizeH
End With
ActiveWorkbook.Charts(ChartName).CopyPicture
Appearance:=xlScreen, _
Size:=xlScreen, Format:=xlPicture
End Sub
__________________________________________________ ________

I also want the chart to be updated each time changes is
made in the worksheets.

Can anybody show me how to solve this problem in excel
2000/2002?

Thank you.

Regards,
Sheela



All times are GMT +1. The time now is 01:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com