473,581 Members | 2,497 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Loadpicture and Msgbox issue

1 New Member
Hi
I am using this code in Excel to display an ID image based on the ID number. Code also checks the expiry date of the ID and diplays a message. Everything works properly except that message box pops up before image is displayed. I want the message to appear after image is loaded. Could someone help me?

Thanks in advance.
Shine

Expand|Select|Wrap|Line Numbers
  1. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  2. On Error Resume Next
  3. Image1.Picture = LoadPicture(Range("A1").Value & "0.jpg")
  4. If Range("E4").Value = "" Or Range("E7").Value = "Record Not Found" Then
  5.     Filepath = Range("A1").Value & "0.jpg"
  6.     Image1.Picture = LoadPicture(Filepath)
  7. Else
  8.     Filepath = Range("A1").Value & Range("E4").Value & ".jpg"
  9.     Image1.Picture = LoadPicture(Filepath)
  10. End If
  11.  
  12. If Range("E13").Value < Date Then
  13.  msg = MsgBox("Expired")
  14. End If
  15. End Sub
Oct 18 '07 #1
1 1543
Killer42
8,435 Recognized Expert Expert
At line 11, try putting in a DoEvents. And if that doesn't help, maybe also Image1.Refresh.

By the way, are lines 3 and 6 meant to do the same thing? Seems a bit superfluous.
Oct 18 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
5982
by: js | last post by:
Hi all, I currently encounter a problem and it is urgent to me. After calling the MsgBox.Show(), the message box is shown with non-modal mode, what is the possible reason??? This only happen in the VB project, works fine in C# project. SystemModal and ApplicationModal MsgBoxStyle were all tried and there was no help.
0
1237
by: KBrq | last post by:
I use an ActiveX control that accepts a StdPicture in some of it's properties. My question is: how do I load a bitmap from a file and get a StdPicture out of it. In VB6.0 I used LoadPicture. Is there a replacement for this function, and if not, is it possible to access LoadPicture from VB.NET ? I'm aware of Image.FromFile but that one...
1
1510
by: phaseo | last post by:
I am having a weird problem with msgbox and other dialogs in VB.Net using Visual studio .Net 2003. The dialog box comes up with no text in it, not even the OK on the button. However when I step through the code in Debug the dialog works properly. Any help is greatly appreciated. I tried a simple windows form with MsgBox("Show me") as the fist...
1
1993
by: Jay at SCA | last post by:
I've been having the following issue with a windows service I've created in vb.net (.net fw 1.1): Basically, my service monitors a folder for the creation of any new files of a particular type and renames them using the "Rename(oldfilename,newfilename)" function. Unfortunately, this function only seems to work if and only if it is...
3
3121
by: cullens_aust | last post by:
Can anyone help me with this code for vb I am trying to access different pictures at different times Dim pic As String Static x As Integer Picture1.Visible = True 'If x = File1.ListCount Then x = 0 'x = File1.ListIndex
5
11953
by: Shelby | last post by:
Hi, when I try to use LoadPicture(myFilePath) in my vb.net project, it says "LoadPicture" is not declared. Dim pic as stdole.IPictureDisp pic = LoadPicture(myFilePath) Do I need to add any reference or import any namespace?
1
2473
by: samadams_2006 | last post by:
Hello, I'm using "Visual Studio 2005" and VB.NET to be more exact. I have the following article which shows me how to set the mask and picture properties for Office XP Commandbars: http://support.microsoft.com/kb/286460/ The issue is the fact that this article is for Visual Basic 6 and I'm running VB.NET. The program fails to compile...
5
4794
by: Iulian Ilea | last post by:
Hello! I've created a PDF report and trying to load a picture using LoadPicture fucntion. It works fine on my computer but it gives an error on some other computers - permision denied, or something similar. Code: ---------- Dim myImg, fs Set fs= Server.CreateObject("Scripting.FileSystemObject")
4
2562
by: Craggy | last post by:
Hi, I am trying to pop up a yes/no message box so that a user can delete a record in a continuous form. The default delete message is a bit sloppy because it seems to move the continuous form to the position of the record u want to delete. If you then choose to not to delete the record it looks to a user as if it has deleted every record before...
0
7792
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8149
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8304
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8175
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5674
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3805
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1403
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1138
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.