LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default alternative to using the 'chart method' to exporting range as .jpg file


Hi All!

I've finally found the code I need to save the contents in MS Paint
(originally copied from Excel) in the required image format (.jpg =
lower quality than .png, but more compatible with various image
viewers). So here's the code to insert into the sub, after having
shelled MS Paint:




' Set Save As Parms
FileName = ThisWorkbook.Name

Application.Wait Now + TimeValue("00:00:01")
SendKeys ALT & "F", True ' File Menu
DoEvents
Application.Wait Now + TimeValue("00:00:01")
SendKeys "A", True ' Save As dialog
DoEvents
Application.Wait Now + TimeValue("00:00:01")
SendKeys Left(FileName, Len(FileName) - 1), True
DoEvents
SendKeys "{BACKSPACE 4}", True
DoEvents
SendKeys ".jpg", True ' Set image format
DoEvents
Application.Wait Now + TimeValue("00:00:02")
SendKeys "{TAB}", True ' Select 'save as
type' drop down menu
DoEvents
Application.Wait Now + TimeValue("00:00:01")
SendKeys "{DOWN 2}", True ' Select .jpg file
format
DoEvents
Application.Wait Now + TimeValue("00:00:01")
SendKeys "{ENTER}", True ' Activate
selection
DoEvents
Application.Wait Now + TimeValue("00:00:01")
SendKeys ALT & "S", True ' Save
DoEvents
Application.Wait Now + TimeValue("00:00:03")

'Close MS Paint
SendKeys ALT & "{F4}", True
DoEvents





I had to adapt the code for MS Paint for Windows XP to select the .jpg
format from the 'Save As Type' drop-down box. In MS Paint for Vista,
this part is not required since it automatically accepts the format as
specified by the extension.

Thanx to all of you for your valuable input!

ARbitOUR


--
ARbitOUR
------------------------------------------------------------------------
ARbitOUR's Profile: http://www.thecodecage.com/forumz/member.php?userid=254
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=99833

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Alternative copy/delete method needed KevHardy Excel Discussion (Misc queries) 2 February 11th 10 01:39 PM
Alternative to QueryTables.Add method or Range.CopyFromRecordset??? [email protected] Excel Programming 1 May 27th 05 04:26 PM
Exporting Chart to GIF File [email protected] Excel Programming 11 April 10th 05 11:53 PM
Exporting chart to GIF file Dick Scratcher Excel Programming 5 November 1st 04 07:54 AM
Trouble exporting chart to htm file - need help Jacson Excel Programming 3 January 10th 04 07:22 AM


All times are GMT +1. The time now is 12:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"