Home > Software engineering >  How to use VB program in excel to sheet1 copy some of the pictures to sheet2 in specific location?
How to use VB program in excel to sheet1 copy some of the pictures to sheet2 in specific location?

Time:11-17

Option Explicit
Dim xlApp As Excel. Application
'Dim xlApp As New Excel. Application
Dim wb As Excel. The Workbook
Dim the ws As Excel. The Worksheet
'image property shall not be set to "size and location are fixed," remember,
Private Sub Command1_Click ()

Unload Me
The Set xlApp=New Excel. Application
XlApp. ScreenUpdating=False 'don't refresh
The Set xlApp=CreateObject (" excel. Application ") 'the first layer
XlApp. WindowState=xlMinimized 'xlMaximized minimize maximize/
XlApp. Visible=True 'False' excel menu bar is Visible
Application. DisplayAlerts=False 'True

The Set wb=CreateObject (App) Path & amp; "\ XXX. XLSX") to your file path change
'Wb. Windows (1). The Visible=True

Wb. Sheets (" sheet1 "). Select
Range (" A1 "). Select '
Selection. Copy 'replication in the cell A1 image

Wb. Sheets (" sheet2 "). Select
Range (" B2 "). Select 'orientation, where
pasteActiveSheet. Pictures. Paste 'in picture format affixed to the B2 cell

Wb. Save
Wb. Close

'xlApp. Quit
'xlApp=Nothing
MsgBox "finished!"
End
End Sub

CodePudding user response:

If you don't know how to choose the Sheet1 in the picture?

CodePudding user response:

@ milaoshu1020 is, glad to

CodePudding user response:

ActiveSheet. Pictures (1) Copy
This line of code you can copy the current worksheet first picture;
  • Related