English 中文(简体)
我如何使用沙皮。 AddShape方法添加“目标”
原标题:How can I use Shapes.AddShape method to add Camera Object

如果我记录宏观。 我看见这一法典。

Selection.Copy
ActiveSheet.Shapes.AddShape(, 480.75, 171#, 63#, 63#).Select
ActiveSheet.Shapes.Range(Array("Picture 2")).Select
Application.CutCopyMode = False

当我看一看MonoAutoShapeType的屠杀时,我看不见照相物体。

And if I change any value it gives exception... (, 480.75, 171#, 63#, 63#) the documentation says that these values are top,left,width and height ...

我想书写一种能够制造任何射程的照相物体的方法。

Sub TakePhoto(myRange As String, myPicture As String)

我如何能够做到这一点?

最佳回答

为此:

Sub TakePhoto(rngSource As Excel.Range, rngTarget As Excel.Range)
Dim ws As Excel.Worksheet
Dim shpPicture As Excel.Shape

Set ws = rngTarget.Parent
rngSource.Copy
ws.Pictures.Paste Link:=True
Set shpPicture = ws.Shapes(ws.Shapes.Count)
With shpPicture
    .Top = rngTarget.Top
    .Left = rngTarget.Left
End With
End Sub

要求这样做:

Sub test()
TakePhoto Sheet2.Range("A1:C4"), Sheet1.Range("c5")
End Sub
问题回答

暂无回答




相关问题
import of excel in SQL imports NULL lines

I have a stored procedure that imports differently formatted workbooks into a database table, does work on them then drops the table. Here is the populating query. SELECT IDENTITY(INT,1,1) AS ID ...

Connecting to Oracle 10g with ODBC from Excel VBA

The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...

Excel date to Unix timestamp

Does anyone know how to convert an Excel date to a correct Unix timestamp?

C# GemBox Excel Import Error

I am trying to import an excel file into a data table using GemBox and I keep getting this error: Invalid data value when extracting to DataTable at SourceRowIndex: 1, and SourceColumnIndex: 1. As ...

Importing from excel "applications" using SSIS

I am looking for any tips or resources on importing from excel into a SQL database, but specifically when the information is NOT in column and row format. I am currently doing some pre-development ...

热门标签