Any Visual Basic Experts?

snapman

VIP Member
Staff member
VIP Member
Premium Member
Joined
Jul 28, 2007
Messages
3,327
Reaction score
3,055
I've grabbed a bit of VB code from the internet that I thought would be handy for work. I've Office 2010 at home and it works fine.

Got to work today, entered the VB code, and I get an error message in the 'MsgBox' line. Here's the code:

Code:
You don't have permission to view the code content. Log in or register now.

My work runs Office 2003. The error highlights the &F.Row&, the "is either within 30 days..." quote, vbLf & _ and vbExclamation + vbYesNo, "Expiry Alarm" areas.

I don't really know Visual Basic (Done the normal Basic a while ago) but I'm familiar with some of the commands. I tried playing about with it today, but with little/no knowledge of VB, I'm stumped.

If anyone with VB knowledge here can help me out it would be gratefully appreciated. I've looked around the internet with no joy :(

Thanks in advance,

snapman
 
This is a sample of the spreadsheet with the code in 'ThisWorkbook'. As you can see I'm also using conditional formatting (was using this so that, besides the MsgBox, there's no way the user could miss expiry dates! lol). Works fine in Excel 2010.

I would really like it to do more, but, as I'm drawing on my old-style Basic knowledge, I'm getting a bit frustrated! lol

Any help in just getting this bit of Visual Basic code to work HimHer in Excel 2003 would be appreciated mate.

Thanks HimHer,

snapman
 

Attachments

  • test3.zip
    17.6 KB · Views: 7
Last edited:
TBH, I reckon the problem lies not in VBA but in file compatibility.

If I just load it in Excel 2003 (SP3, Office Compatibility Pack installed), it whinges at me about file format and loads Read-Only but otherwise works.

However, if I save it in 2003 Workbook format it's fine.
 
TBH, I reckon the problem lies not in VBA but in file compatibility.

If I just load it in Excel 2003 (SP3, Office Compatibility Pack installed), it whinges at me about file format and loads Read-Only but otherwise works.

However, if I save it in 2003 Workbook format it's fine.

Thanks Him Her. Will try it in the saved 2003 Workbook format at work. I didn't do this before because I got this message box saying "Significant loss of functionality" with a list of problems. I'll see what happens mate! lol
 
I could be to do with the level of Visual Basic. Office 2010 will obviously come with a newer version of Visual Basic than Office 2003. So office 2003 might not recognise the newer commands or functions.
 
Saved it as 2003 Workbook and works fine. Looked at the VB code to see if saving it in 2003 compatibility mode had changed anything..... NOPE! But when I manually typed in the code created in 2007 into 2003, errors kept popping up! :err:

Anyway, the code now works on 2003. Thanks Him Her :)
 
Back
Top