Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi John,
Right-click each of the pictures and assign it to thwe macro: Zoom_Pic. In a standard module, at the head of the module, before any other procedures paste the following code: '=========== Option Explicit Private myPic As Picture Private dHeight As Double Private dWidth As Double Private RunWhen As Double Private blStop As Boolean Private Const cRunIntervalSecondi = 10 '\\ 10 sSeconds Private Const cRunWhat = "RestorePicture" '-------------- Public Sub Zoom_Pic() Const ZoomFactor As Double = 2 If blStop Then Exit Sub End If Set myPic = ActiveSheet.Pictures(Application.Caller) With myPic dWidth = .Width dHeight = .Height .Width = ZoomFactor * dWidth .Height = ZoomFactor * dHeight blStop = True End With RunWhen = Now + TimeSerial(0, 0, cRunIntervalSecondi) Application.OnTime EarliestTime:=RunWhen, _ Procedu=cRunWhat, _ Schedule:=True End Sub '-------------- Public Sub RestorePicture() With myPic .Width = dWidth .Height = dHeight End With blStop = False End Sub '<<========== As written, the code zooms the clicked picture end restores the picture to its original dimensions after 10 seconds. The zoom factor may be changed by modifying the value of the ZoomFactor constant; the current value of 2 doubles t he size of the original picture. The time interval (in seconds) is controlled by the Public constant cRunIntervalSecondi. --- Regards. Norman "John" wrote in message ... I would like to have a macro that when run on a selected picture it enlarges its size and then when unselected resizes smaller... There will be several pictures in the worksheet that I would like to run the same code on... Any help is appreciated |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Resize cell to fit picture | Excel Discussion (Misc queries) | |||
Resize comments with only picture. | Excel Programming | |||
Automatically resize a picture to a cell | Excel Programming | |||
Resize Picture / object in Excel | Excel Programming | |||
Set up menu to resize picture upon right click | Excel Discussion (Misc queries) |