View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Run certain macros based on operating system

Couldn't you just look at the first xx characters:

if lcase(left(application.operatingsystem,19)) _
= lcase("Windows (32-bit) NT") then

or

if lcase(application.operatingsystem) like lcase("Windows (32-bit) NT*") then
....

===========
Ron de Bruin has a bunch of notes about emailing via code:
http://www.rondebruin.nl/sendmail.htm

I think he uses CDO (I've never used it) to overcome some problems with
different versions of Outlook.

"Mr. Smith" wrote:

Dave:
Thanks. I'll give it a whirl.
One other question: Is there a way for the macro to just look
at "Windows (32-bit) NT 5" and "Windows (32-bit) NT 4" portion to
determine if it's an XP or NT machine? (I want to be sure it will run
whether it's 5.01 or 5.02, etc.)
Where I work, we have a mix of NT4 machines that should be in
a Dumpster and XP Pro workstations. Because people jump around, they'd
need this workbook to work wherever they are.
Specifically, the workbook with the macros does its thing then
e-mails the resulting workbook. With XP, I have a macro that calls the
mail server (bypassing the need for an e-mail client) and will
silently send the workbook. This is the way I'd prefer, but on NT, it
doesn't work. I have another macro that does, which uses Outlook to
mail the file. The macro that works on NT, doesn't work on XP, and
vice versa.
I'm sure there are easier ways to do this stuff but I'm not
savvy with Excel.
Thanks again for the help.

On Thu, 27 Jul 2006 16:27:37 -0500, Dave Peterson
wrote:

if lcase(Application.OperatingSystem) = lcase("Windows (32-bit) NT 5.01") then
'do xp stuff
else
'do non-xp stuff
end if

Just curious -- what will you be using that depends on the operating system
version?

"Mr. Smith" wrote:

I need a workbook with macros that need to run on machines
with older versions of Windows NT 4 and others on Windows XP
Professional.
Instead of making two separate workbooks, I'd like an IF-THEN
scenario using the =INFO("osversion") formula to determine the
operating system and if it's not XP -- I get "Windows (32-bit) NT
5.01" with the osversion formula on the XP machines -- to run the
NT-compatible macro.
But, being a newbie, I don't know how to go about that.
I Googled for an example, but came up empty. I would have to
imagine someone else has come across this problem before.
Thanks for any help/pointers, etc.


--

Dave Peterson