复制在多个单元格中旋转并粘贴
我正在使用Excel VBA函数来生成条形码作为图像,并将其粘贴在两个单元格中。
只有第一个糊状是旋转的,而不是第二个糊状物。
Set xObjOLE = ActiveSheet.OLEObjects.Add("BARCODE.BarCodeCtrl.1")
xObjOLE.Object.Style = 7
xObjOLE.Object.Value = "0123456789"
xObjOLE.Width = 120
xObjOLE.Height = 30
xObjOLE.CopyPicture xlScreen, xlPicture
Set xRRg = Application.Range("H5")
ActiveSheet.Paste xRRg
With Selection
.ShapeRange.Rotation = 270
End With
Set xRRg = Application.Range("S5")
ActiveSheet.Paste xRRg
With Selection
.ShapeRange.Rotation = 270
End With
xObjOLE.Delete
I am using an Excel VBA function to generate a barcode as image and paste it with rotation in two cells.
Only the first paste is rotated and not the second one.
Set xObjOLE = ActiveSheet.OLEObjects.Add("BARCODE.BarCodeCtrl.1")
xObjOLE.Object.Style = 7
xObjOLE.Object.Value = "0123456789"
xObjOLE.Width = 120
xObjOLE.Height = 30
xObjOLE.CopyPicture xlScreen, xlPicture
Set xRRg = Application.Range("H5")
ActiveSheet.Paste xRRg
With Selection
.ShapeRange.Rotation = 270
End With
Set xRRg = Application.Range("S5")
ActiveSheet.Paste xRRg
With Selection
.ShapeRange.Rotation = 270
End With
xObjOLE.Delete
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的第一个建议是旋转原始图像,然后将其粘贴到两个地方。
另一种选择是选择副本,但是为此,我需要知道您是否有文件中的其他图像。
第一个解决方案
为了使其可再现,我仅添加了“集合”块的代码。鉴于此,您需要先选择一个图像,然后运行我的代码。
如果您有任何疑问,请告诉我。
my first suggestion is rotating the original image, then paste it in two places.
The alternative is selecting the copies, but for that I need to know if you have other images in the file.
First solution
To make it reproducible I am adding only the code for the "Set" chunk. Given that, you need to select an image first, then run my code.
Please let me know if you have any question.