InsertPicture Goes to Wrong Cell

Brantsudd

New Member
Joined
Jun 30, 2011
Messages
2
<hr style="background-color: rgb(235, 235, 235); color: rgb(235, 235, 235);" size="1"> <!-- / icon and title --><!-- message -->
<!-- BEGIN TEMPLATE: ad_showthread_firstpost_start --><!-- END TEMPLATE: ad_showthread_firstpost_start -->I have an Excel file, compiled with DoneEx Compiler, with extensive calculations/iterations and approximately 30 pages of VBA code. So far, it has been trialed on 4 computers, including my own PC. My PC runs Win Vista with Excel 2003, one PC runs Win XP with Excel 2003, and 2 PC's run Win 7 with Excel 2007. All of the code executes on all computers except one with Win 7 and Excel 2007. I have the below code to insert a .bmp "flowsheet" picture, followed by adding some labels and values surrounding the flowsheet. On that 1 PC, the "flowsheet" .bmp inserts at cell B4, or even half way across cell A4, thus blocking much of the critical input/output data in cells A4 to about H20. From my code below, it should insert at cell E135. Labels and data insert properly. We've tried to play with his screen resolution, 1280 x 800, plus and minus. I also inserted a 2 sec. delay between the calcs and the final step which is the insertion of the .bmp file and labels as below. None of this has worked. I find it curious that this compiled file works perfectly on a similar PC with the same op. system and the same version of Excel. Can you help me? He has SP2 for Excel 2007 installed. Any suggestions on how to cure this issue?

Thanks for the help,

Brant

InsertPicture:
ActiveSheet.Unprotect ("xxxx")
If FLOWSHEET = "1E X 1S" Then
Range("E133.S154").Value = "" 'clears the last set of labels and data points;
'other code is used to clear/delete the flowsheet.bmp pic.
With ActiveSheet.Pictures.Insert("C:\program files\CuPRO-Calc\flowsheets\1Ex1SsubPic1.bmp")
.Left = Range("E135").Left
.Top = Range("E135").Top
End With
ActiveSheet.Protect ("xxxx")
Range("D141").Value = Range("B8").Value
Range("C141").Value = "PLS g/l="
Range("G146").Value = Range("S21").Value
Range("F146").Value = "Raff. g/l="
Range("M141").Value = Range("T28").Value
Range("L141").Value = "SE g/l="
Range("I146").Value = Range("T29").Value
Range("H146").Value = "PE g/l="
Range("M139").Value = Range("S28").Value
Range("L139").Value = "SO g/l="
Range("M138").Value = Range("S29").Value
Range("L138").Value = "LO g/l="
Range("B74") = "Complete!"
Range("J13") = "Complete!"
Range("J14") = "None."
Range("B135") = "None."
Range("B8").Select
End
End If

ActiveSheet.Unprotect ("xxxx")
If FLOWSHEET = "2E X 2S" Then
Range("E133.S154").Value = "" 'clears the last set of labels and data points; other code is used to clear/delete the flowsheet.bmp pic.
With ActiveSheet.Pictures.Insert("C:\program files\CuPRO-Calc\flowsheets\2Ex2SsubPic1.bmp")
.Left = Range("E135").Left
.Top = Range("E135").Top
End With
ActiveSheet.Protect ("xxxx")
Range("D141").Value = Range("B8").Value
Range("C141").Value = "PLS g/l="
Range("G146").Value = Range("S21").Value
Range("F146").Value = "Raff. g/l="
Range("M141").Value = Range("T28").Value
Range("L141").Value = "SE g/l="
Range("I146").Value = Range("T29").Value
Range("H146").Value = "PE g/l="
Range("M139").Value = Range("S28").Value
Range("L139").Value = "SO g/l="
Range("M138").Value = Range("S29").Value
Range("L138").Value = "LO g/l="
Range("B74") = "Complete!"
Range("J13") = "Complete!"
Range("J14") = "None."
Range("B135") = "None."
Range("B8").Select
End
End If

<!-- / message --><!-- BEGIN TEMPLATE: ad_showthread_firstpost_sig --><!-- END TEMPLATE: ad_showthread_firstpost_sig -->
<!-- controls -->
progress.gif
 
Last edited by a moderator:

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Does this work?

Code:
ActiveSheet.Pictures.Insert ("C:\program files\CuPRO-Calc\flowsheets\1Ex1SsubPic1.bmp")
With ActiveSheet.Shapes(ActiveSheet.Shapes.Count)
    .Top = Range("E135").Top
    .Left = Range("E135").Left
End With
 
Upvote 0
Thanks so much for the response. The new code works well on my compiled file, so now I have to wait until Monday to get a reply from the guy in S. Africa. We hope it works. The DoneEx
Compiler help line suggested it may be due to an Add-In or to User Account settings. Any thoughts on this?

Thanks again,

Brant
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,703
Members
452,938
Latest member
babeneker

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