_ExcelTips_의 다른 문제에서는 카메라 도구를 사용하여 워크 시트의 여러 부분에 대한 동적 그림을 캡처하는 방법에 대해 알아 봅니다. VBA 내에서 동일한 종류의 기능을 사용하는 방법에 대해 궁금 할 것입니다.

문제에 대한 문서는 그다지 명확하지 않지만 다음 매크로는 일반적인 프로세스를 보여줍니다.

Sub DoCamera()

Dim MyPrompt As String     Dim MyTitle As String     Dim UserRange As Range     Dim OutputRange As Range

Application.ScreenUpdating = True

'Prompt user for range to capture     MyPrompt = "Select the range you would like to capture."

MyTitle = "User Input Required"

On Error Resume Next     Set UserRange = Application.InputBox(Prompt:=MyPrompt, _         Title:=MyTitle, Default:=ActiveCell.Address, Type:=8)

If UserRange Is Nothing Then End     On Error GoTo 0

'Copy range to Clipboard as picture     UserRange.CopyPicture

'Prompt user for range to paste to     MyPrompt = "Select the range on which you would like to paste."

MyTitle = "User Input Required"

On Error Resume Next     Set OutputRange = Application.InputBox(Prompt:=MyPrompt, _         Title:=MyTitle, Default:=ActiveCell.Address, Type:=8)

If OutputRange Is Nothing Then End     On Error GoTo 0

'Paste picture to output range     OutputRange.PasteSpecial     Selection.Formula = UserRange.Address End Sub

이 매크로는 복사 할 범위를 지정하라는 메시지를 표시 한 다음 클립 보드에 그림으로 복사하고 붙여 넣을 위치를 묻는 메시지를 표시합니다.

붙여 넣을 때 매크로의 마지막 선은 카메라 도구를 사용하여 수동으로 수행하는 것처럼 “사진”을 동적으로 만드는 핵심입니다. PasteSpecial 명령은 실제로 그림을 붙여넣고 붙여 넣은 그림은 선택된 상태로 유지됩니다. 선택 항목 (그림)에 대한 수식 속성을 설정하면 그래픽이 동적으로 나타납니다.

_ 참고 : _

이 페이지 (또는 ExcelTips 사이트의 다른 페이지)에 설명 된 매크로를 사용하는 방법을 알고 싶다면 유용한 정보가 포함 된 특별 페이지를 준비했습니다.

link : / excelribbon-ExcelTipsMacros [새 브라우저 탭에서 특별 페이지를 열려면 여기를 클릭하세요].

_ExcelTips_는 비용 효율적인 Microsoft Excel 교육을위한 소스입니다.

이 팁 (10521)은 Office 365의 Microsoft Excel 2007, 2010, 2013, 2016, 2019 및 Excel에 적용됩니다. 여기에서 Excel의 이전 메뉴 인터페이스에 대한이 팁 버전을 찾을 수 있습니다.

link : / excel-Using_the_Camera_in_VBA [VBA에서 카메라 사용].