我在$day=11/21/2017
$today=Get-Date
if (Today=$day)
{
echo"Happy 18th Birthday [Jular]"}
else
{
echo"Eat Cake Anyway"
}
收到编译错误。我试图做的就是解锁从用户导入的图像的宽高比。我会假设我没有使用正确的语法,任何帮助都会很棒
img.LockAspectRatio = msoFalse
答案 0 :(得分:1)
当您尝试插入图片时,请将类型声明为Picture
而不是Object
。使用LockAspectRatio在ShapeRange
属性下可用。
Sub ChangeImage()
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.ButtonName = "Submit"
.Title = "Select an image file"
.Filters.Clear
.Filters.Add "All Pictures", "*.*"
If .Show = -1 Then
Dim img As Picture '/ Declare as Picture
Set img = ActiveSheet.Pictures.Insert(.SelectedItems(1))
'/ Use ShapeRange to toogle aspect ratio
img.ShapeRange.LockAspectRatio = msoFalse
img.Left = 141
img.Top = 925
img.Width = 600
img.Height = 251
Else
Debug.Print "Prompt closed"
End If
End With
End Sub