Save as bitmap

  • Follow


All:

Need assistance on macro code to do the following:

From a command button - copy a range from a worksheet (A1:D9), then save 
selection as a bitmap (picture) on the desktop.

Thank you in advance.
0
Reply Utf 1/8/2010 9:22:01 PM

Hi,

Try this :

Modify sheet name and range address at your convenient.

'--------------------------------------------
Sub Save_Range_On_Desktop()

Application.ScreenUpdating = False
With Sheets("Sheet1")
    .Activate
    Workbooks.Add
    .Range("A2:H31").CopyPicture
End With
With ActiveSheet
    .Paste
    With .ChartObjects.Add(0, 0, _
        Selection.Width, Selection.Height).Chart
        .Paste
        .ChartArea.Border.LineStyle = 0
    End With
    With .ChartObjects(1)
        .Top = 0
        .Left = 0
        .Chart.Export "C:\Users\DM\Desktop\Its_Name.bmp", "bmp"
    End With
    .Parent.Close False
End With
Application.ScreenUpdating = True
End Sub
'--------------------------------------------

"Maze" <Maze@discussions.microsoft.com> a écrit dans le message de groupe de discussion : 
172D24F1-AEFF-48F7-8E9E-C9C5441318BC@microsoft.com...
All:

Need assistance on macro code to do the following:

From a command button - copy a range from a worksheet (A1:D9), then save
selection as a bitmap (picture) on the desktop.

Thank you in advance. 

0
Reply michdenis 1/9/2010 12:37:32 AM


Thank you for responding  - is there anything else I need to do, I keep 
getting a Syntax error, starting on the first .Activate

"michdenis" wrote:

> Hi,
> 
> Try this :
> 
> Modify sheet name and range address at your convenient.
> 
> '--------------------------------------------
> Sub Save_Range_On_Desktop()
> 
> Application.ScreenUpdating = False
> With Sheets("Sheet1")
>     .Activate
>     Workbooks.Add
>     .Range("A2:H31").CopyPicture
> End With
> With ActiveSheet
>     .Paste
>     With .ChartObjects.Add(0, 0, _
>         Selection.Width, Selection.Height).Chart
>         .Paste
>         .ChartArea.Border.LineStyle = 0
>     End With
>     With .ChartObjects(1)
>         .Top = 0
>         .Left = 0
>         .Chart.Export "C:\Users\DM\Desktop\Its_Name.bmp", "bmp"
>     End With
>     .Parent.Close False
> End With
> Application.ScreenUpdating = True
> End Sub
> '--------------------------------------------
> 
> "Maze" <Maze@discussions.microsoft.com> a écrit dans le message de groupe de discussion : 
> 172D24F1-AEFF-48F7-8E9E-C9C5441318BC@microsoft.com...
> All:
> 
> Need assistance on macro code to do the following:
> 
> From a command button - copy a range from a worksheet (A1:D9), then save
> selection as a bitmap (picture) on the desktop.
> 
> Thank you in advance. 
> 
0
Reply Utf 1/11/2010 6:21:02 PM

Danses pour le groupe avancé 

0
Reply michdenis 1/11/2010 6:50:04 PM


"Maze" <Maze@discussions.microsoft.com> a écrit dans le message de groupe de discussion : 
B9964347-1FF3-4F78-BF1B-4537DE37E64B@microsoft.com...
Thank you for responding  - is there anything else I need to do, I keep
getting a Syntax error, starting on the first .Activate

"michdenis" wrote:

> Hi,
>
> Try this :
>
> Modify sheet name and range address at your convenient.
>
> '--------------------------------------------
> Sub Save_Range_On_Desktop()
>
> Application.ScreenUpdating = False
> With Sheets("Sheet1")
>     .Activate
>     Workbooks.Add
>     .Range("A2:H31").CopyPicture
> End With
> With ActiveSheet
>     .Paste
>     With .ChartObjects.Add(0, 0, _
>         Selection.Width, Selection.Height).Chart
>         .Paste
>         .ChartArea.Border.LineStyle = 0
>     End With
>     With .ChartObjects(1)
>         .Top = 0
>         .Left = 0
>         .Chart.Export "C:\Users\DM\Desktop\Its_Name.bmp", "bmp"
>     End With
>     .Parent.Close False
> End With
> Application.ScreenUpdating = True
> End Sub
> '--------------------------------------------
>
> "Maze" <Maze@discussions.microsoft.com> a écrit dans le message de groupe de discussion 
> :
> 172D24F1-AEFF-48F7-8E9E-C9C5441318BC@microsoft.com...
> All:
>
> Need assistance on macro code to do the following:
>
> From a command button - copy a range from a worksheet (A1:D9), then save
> selection as a bitmap (picture) on the desktop.
>
> Thank you in advance.
> 
0
Reply michdenis 1/11/2010 6:51:40 PM


"Maze" <Maze@discussions.microsoft.com> a écrit dans le message de groupe de discussion : 
B9964347-1FF3-4F78-BF1B-4537DE37E64B@microsoft.com...
Thank you for responding  - is there anything else I need to do, I keep
getting a Syntax error, starting on the first .Activate

"michdenis" wrote:

> Hi,
>
> Try this :
>
> Modify sheet name and range address at your convenient.
>
> '--------------------------------------------
> Sub Save_Range_On_Desktop()
>
> Application.ScreenUpdating = False
> With Sheets("Sheet1")
>     .Activate
>     Workbooks.Add
>     .Range("A2:H31").CopyPicture
> End With
> With ActiveSheet
>     .Paste
>     With .ChartObjects.Add(0, 0, _
>         Selection.Width, Selection.Height).Chart
>         .Paste
>         .ChartArea.Border.LineStyle = 0
>     End With
>     With .ChartObjects(1)
>         .Top = 0
>         .Left = 0
>         .Chart.Export "C:\Users\DM\Desktop\Its_Name.bmp", "bmp"
>     End With
>     .Parent.Close False
> End With
> Application.ScreenUpdating = True
> End Sub
> '--------------------------------------------
>
> "Maze" <Maze@discussions.microsoft.com> a écrit dans le message de groupe de discussion 
> :
> 172D24F1-AEFF-48F7-8E9E-C9C5441318BC@microsoft.com...
> All:
>
> Need assistance on macro code to do the following:
>
> From a command button - copy a range from a worksheet (A1:D9), then save
> selection as a bitmap (picture) on the desktop.
>
> Thank you in advance.
> 
0
Reply michdenis 1/11/2010 6:51:52 PM

For prereceding version of excel 2007
Menu bar / tools / Macros or procedures / Security / approved editors /
you have to check the 2 checkboxes in the button of the window.

Excel 2007,
Office button / Options Excel / Confidentiality gestion center / Parameters /
Macro parameters / and you have to check the case : Approved access ... vba project

These informations have been translated from a french version...
sorry if the command name button have a different caption than those used.



"Maze" <Maze@discussions.microsoft.com> a écrit dans le message de groupe de discussion : 
B9964347-1FF3-4F78-BF1B-4537DE37E64B@microsoft.com...
Thank you for responding  - is there anything else I need to do, I keep
getting a Syntax error, starting on the first .Activate

"michdenis" wrote:

> Hi,
>
> Try this :
>
> Modify sheet name and range address at your convenient.
>
> '--------------------------------------------
> Sub Save_Range_On_Desktop()
>
> Application.ScreenUpdating = False
> With Sheets("Sheet1")
>     .Activate
>     Workbooks.Add
>     .Range("A2:H31").CopyPicture
> End With
> With ActiveSheet
>     .Paste
>     With .ChartObjects.Add(0, 0, _
>         Selection.Width, Selection.Height).Chart
>         .Paste
>         .ChartArea.Border.LineStyle = 0
>     End With
>     With .ChartObjects(1)
>         .Top = 0
>         .Left = 0
>         .Chart.Export "C:\Users\DM\Desktop\Its_Name.bmp", "bmp"
>     End With
>     .Parent.Close False
> End With
> Application.ScreenUpdating = True
> End Sub
> '--------------------------------------------
>
> "Maze" <Maze@discussions.microsoft.com> a écrit dans le message de groupe de discussion 
> :
> 172D24F1-AEFF-48F7-8E9E-C9C5441318BC@microsoft.com...
> All:
>
> Need assistance on macro code to do the following:
>
> From a command button - copy a range from a worksheet (A1:D9), then save
> selection as a bitmap (picture) on the desktop.
>
> Thank you in advance.
> 
0
Reply michdenis 1/11/2010 7:10:11 PM

6 Replies
275 Views

(page loaded in 0.107 seconds)

Similiar Articles:
















7/17/2012 6:18:13 PM


Reply: