Bitmap link will update in XL2007, but not in XL2010

tingling

New Member
Joined
Oct 8, 2013
Messages
2
(I'm a bit of a beginner in writing macros - only started to learn it to prepare myself to be humiliated in the ModelOff competition :D so I hope this isn't too silly a question.. but anyway)


I inserted some bitmap images in my spreadsheet and I wanted to use macros to change the image displayed while my macro is doing other stuff in the background, so I added something like this in between my codes...


Code:
   ActiveSheet.Shapes("Picture 1").Select
   Selection.Formula = "Image1" 
        '...Codes to get Excel to wait a few seconds...
   ActiveSheet.Shapes("Picture 1").Select
   Selection.Formula = "Image2"


Well, it's mostly for aesthetic reasons, but anyway, it works as intended when I run it on my laptop with Excel 2007, but when I tried my spreadsheet on my PC with Excel 2010, it seems to only display the first and last images. I think my laptop runs Windows XP and my PC runs Windows 7 - I didn't get to try my spreadsheets on other machines yet.


I also tried using OFFSET in the formula of the bitmap image, and changing a value in a linked cell, which works fine with Excel 2007, but again, Excel 2010 is being a bit stubborn.


Anyone know what I can do to fix it? :p, or an alternative I can use to get the desired effect?


Some other info:


I also have another spreadsheet that has 20+ bitmap images, but because all the bitmap images were making my spreadsheet lag, I used a similar code to update my images only when it's really necessary, and then removing the links so my spreadsheet still can do its work decently, by having something like this in my code:


Code:
'... After an event is triggered...


For X = 1 to 10
  ActiveSheet.Shapes("Picture "&X).Select
   Selection.Formula = "Image"&X 
   Selection.Formula = ""
Next X


Again it works as intended in Excel 2007, but as for Excel 2010...


I could get it to work as intended (in Excel 2010) if I manually used two separate macros (I only know how to run macros by getting the user to click on a button, 2 buttons in this case - am still trying to learn how to run macros that run in the worksheet automatically - I understand you have to write the codes, but not in the module - right? Nevermind, I'll figure that out one day)


First macro from first button
Code:
Sub UpdatePicLinks()
For X = 1 to 10
  ActiveSheet.Shapes("Picture "&X).Select
   Selection.Formula = "Image"&X 
Next X
End Sub


Second macro from second button
Code:
Sub RemovePicLinks()
For X = 1 to 10
  ActiveSheet.Shapes("Picture "&X).Select 
   Selection.Formula = ""
Next X
End Sub


--> It doesn't work if I run a macro from one button


Code:
Sub UpdatePic_Button()
Application.Run ("UpdatePicLinks")
Application.Run ("RemovePicLinks")
End Sub


Hope that makes sense :p
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
O.. actually.. Nevermind.. I found the solution..

I forced it to refresh by inserting

ActiveWindow.SmallScroll Up:=1

after the bitmap link is updated.

It didn't work when I used Range("A1").Select

But smallscroll does the trick :p (which works for me because my worksheet is fixed to the top row. Not sure what I need to do if my worksheet isn't really meant to scroll.
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top