Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default PC to Mac VBA Cross-platform compatibility

I created what I call a practice sheet generator designed to randomize a
list of items from one worksheet then populate another worksheet. Great for
teaching kids sight words and other applications. However, I created it in
Excel 2000 on my PC and have tried to run it on a Mac using Excel 98 or
higher. It doesn't work at all. On the worksheet that accepts the list,
there are ActiveX controls like CommandButtons that start the code, but
those don't seem to work either.

I don't have regular access to a Mac, but I don't even know how or where to
begin troubleshooting the cross-platform compatiblity issues. Are there
resources out there? Please let me know if I need to provide more details or
code...

Thanks much,
Geoff


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default PC to Mac VBA Cross-platform compatibility

ActiveX is a windows-only technology, so ActiveX controls won't work in
MacXL - use controls from the Forms toolbar instead.

All MacXL versions use VBA5, equivalent to WinXL97. Don't use VBA
methods introduced in VBA6 (such as join, replace, split, etc.). You can
find VBA5 workarounds - look in the archives:

http://groups.google.com/advanced_gr...=group:*excel*

There are a very few other gotchas - for instance, the FileFilter
argument to GetOpenFileName works differently, but that should be in XL
Help. You might also look up Conditional Complilation, i.e.:

'Do cross-platform stuff
#IF Mac
'Do Mac Stuff
#Else
'Do Win Stuff
#End if
'Do cross-platform stuff


In article ,
"Geoff Martin" wrote:

I created what I call a practice sheet generator designed to randomize a
list of items from one worksheet then populate another worksheet. Great for
teaching kids sight words and other applications. However, I created it in
Excel 2000 on my PC and have tried to run it on a Mac using Excel 98 or
higher. It doesn't work at all. On the worksheet that accepts the list,
there are ActiveX controls like CommandButtons that start the code, but
those don't seem to work either.

I don't have regular access to a Mac, but I don't even know how or where to
begin troubleshooting the cross-platform compatiblity issues. Are there
resources out there? Please let me know if I need to provide more details or
code...

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default PC to Mac VBA Cross-platform compatibility

Thanks JE,

Some follow-up questions. I don't have regular access to Macs with Excel.
Aside from the ActiveX issues, and the general types of exceptions you
mention below:

1) If I can get the program to run on Excel 97, is it fairly likely to work
on a Mac?

2) Because of the slowness of changing header/footer settings, I use
Excel4Macros to set those. Will there be a problem on Mac?

3) What is the code to check the OS and what would it return for Mac or
Windows?

4) I looked briefly, but isn't there a setting one can activate somewhere
that makes it to where you can only use VB5 compatible codes?

Thanks again,
Geoff



"JE McGimpsey" wrote in message
...
ActiveX is a windows-only technology, so ActiveX controls won't work in
MacXL - use controls from the Forms toolbar instead.

All MacXL versions use VBA5, equivalent to WinXL97. Don't use VBA
methods introduced in VBA6 (such as join, replace, split, etc.). You can
find VBA5 workarounds - look in the archives:

http://groups.google.com/advanced_gr...=group:*excel*

There are a very few other gotchas - for instance, the FileFilter
argument to GetOpenFileName works differently, but that should be in XL
Help. You might also look up Conditional Complilation, i.e.:

'Do cross-platform stuff
#IF Mac
'Do Mac Stuff
#Else
'Do Win Stuff
#End if
'Do cross-platform stuff


In article ,
"Geoff Martin" wrote:

I created what I call a practice sheet generator designed to randomize a
list of items from one worksheet then populate another worksheet. Great

for
teaching kids sight words and other applications. However, I created it

in
Excel 2000 on my PC and have tried to run it on a Mac using Excel 98 or
higher. It doesn't work at all. On the worksheet that accepts the list,
there are ActiveX controls like CommandButtons that start the code, but
those don't seem to work either.

I don't have regular access to a Mac, but I don't even know how or where

to
begin troubleshooting the cross-platform compatiblity issues. Are there
resources out there? Please let me know if I need to provide more

details or
code...



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default PC to Mac VBA Cross-platform compatibility

In-line.

In article ,
"Geoff Martin" wrote:

Some follow-up questions. I don't have regular access to Macs with Excel.
Aside from the ActiveX issues, and the general types of exceptions you
mention below:

1) If I can get the program to run on Excel 97, is it fairly likely to work
on a Mac?


Yes.


2) Because of the slowness of changing header/footer settings, I use
Excel4Macros to set those. Will there be a problem on Mac?


No.

3) What is the code to check the OS and what would it return for Mac or
Windows?


I use conditional compilation, as I wrote before. You could also use the
Application.OperatingSystem property:

Dim bMacOS As Boolean
bMacOS = (Left(Application.OperatingSystem, 3) = "Mac")
'cross-platform stuff
If bMacOS
'mac specific stuff
Else
'windows specific stuff
End if
'cross platform stuff

4) I looked briefly, but isn't there a setting one can activate somewhere
that makes it to where you can only use VB5 compatible codes?


No. You have to use conditional compilation if you want to include VB6
commands.

I do this all the time in my business. One technique I use is to define
the VBA5 equivalents of VBA6 functions in a separate module, then use
cross-platform code in the remainder. For instance, if I use the VBA6
replace function:

s = Replace(s, "$$", nID)

In a separate module I put

#IF Mac
Public Function Replace(ByRef Text As String, _
ByRef sOld As String, ByRef sNew As String, _
Optional ByVal Start As Long = 1, _
Optional ByVal Count As Long = -1, _
Optional ByVal Compare As Long = vbBinaryCompare _
) As String
'my VBA5 replace function
End Function
#End If

You can find a lot of canned VBA5 equivalents at

http://support.microsoft.com/default...b;en-us;188007

They're not particularly optimized, but they work.

(One tip: MacVBA doesn't define the VbCompareMethod method constant used
in the functions at the above link, which is why I changed it to Long in
the Replace function above).
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default PC to Mac VBA Cross-platform compatibility

Could I but in and ask what about API's? gather some at least may cause
problems or not work in Mac. Is there a list of those that are safe to use,
if any.

TIA, Peter


"JE McGimpsey" wrote in message
...
In-line.

In article ,
"Geoff Martin" wrote:

Some follow-up questions. I don't have regular access to Macs with

Excel.
Aside from the ActiveX issues, and the general types of exceptions you
mention below:

1) If I can get the program to run on Excel 97, is it fairly likely to

work
on a Mac?


Yes.


2) Because of the slowness of changing header/footer settings, I use
Excel4Macros to set those. Will there be a problem on Mac?


No.

3) What is the code to check the OS and what would it return for Mac or
Windows?


I use conditional compilation, as I wrote before. You could also use the
Application.OperatingSystem property:

Dim bMacOS As Boolean
bMacOS = (Left(Application.OperatingSystem, 3) = "Mac")
'cross-platform stuff
If bMacOS
'mac specific stuff
Else
'windows specific stuff
End if
'cross platform stuff

4) I looked briefly, but isn't there a setting one can activate

somewhere
that makes it to where you can only use VB5 compatible codes?


No. You have to use conditional compilation if you want to include VB6
commands.

I do this all the time in my business. One technique I use is to define
the VBA5 equivalents of VBA6 functions in a separate module, then use
cross-platform code in the remainder. For instance, if I use the VBA6
replace function:

s = Replace(s, "$$", nID)

In a separate module I put

#IF Mac
Public Function Replace(ByRef Text As String, _
ByRef sOld As String, ByRef sNew As String, _
Optional ByVal Start As Long = 1, _
Optional ByVal Count As Long = -1, _
Optional ByVal Compare As Long = vbBinaryCompare _
) As String
'my VBA5 replace function
End Function
#End If

You can find a lot of canned VBA5 equivalents at

http://support.microsoft.com/default...b;en-us;188007

They're not particularly optimized, but they work.

(One tip: MacVBA doesn't define the VbCompareMethod method constant used
in the functions at the above link, which is why I changed it to Long in
the Replace function above).





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default PC to Mac VBA Cross-platform compatibility

APIs reference windows OS functions and will not work cross-platform.

In article ,
"Peter T" <peter_t@discussions wrote:

Could I but in and ask what about API's? gather some at least may cause
problems or not work in Mac. Is there a list of those that are safe to use,
if any.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default PC to Mac VBA Cross-platform compatibility

That's definitive!

Thanks, Peter

"JE McGimpsey" wrote in message
...
APIs reference windows OS functions and will not work cross-platform.

In article ,
"Peter T" <peter_t@discussions wrote:

Could I but in and ask what about API's? gather some at least may cause
problems or not work in Mac. Is there a list of those that are safe to

use,
if any.



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default PC to Mac VBA Cross-platform compatibility

Been away the last few days...Thank you so very much for your help!

"JE McGimpsey" wrote in message
...
In-line.

In article ,
"Geoff Martin" wrote:

Some follow-up questions. I don't have regular access to Macs with

Excel.
Aside from the ActiveX issues, and the general types of exceptions you
mention below:

1) If I can get the program to run on Excel 97, is it fairly likely to

work
on a Mac?


Yes.


2) Because of the slowness of changing header/footer settings, I use
Excel4Macros to set those. Will there be a problem on Mac?


No.

3) What is the code to check the OS and what would it return for Mac or
Windows?


I use conditional compilation, as I wrote before. You could also use the
Application.OperatingSystem property:

Dim bMacOS As Boolean
bMacOS = (Left(Application.OperatingSystem, 3) = "Mac")
'cross-platform stuff
If bMacOS
'mac specific stuff
Else
'windows specific stuff
End if
'cross platform stuff

4) I looked briefly, but isn't there a setting one can activate

somewhere
that makes it to where you can only use VB5 compatible codes?


No. You have to use conditional compilation if you want to include VB6
commands.

I do this all the time in my business. One technique I use is to define
the VBA5 equivalents of VBA6 functions in a separate module, then use
cross-platform code in the remainder. For instance, if I use the VBA6
replace function:

s = Replace(s, "$$", nID)

In a separate module I put

#IF Mac
Public Function Replace(ByRef Text As String, _
ByRef sOld As String, ByRef sNew As String, _
Optional ByVal Start As Long = 1, _
Optional ByVal Count As Long = -1, _
Optional ByVal Compare As Long = vbBinaryCompare _
) As String
'my VBA5 replace function
End Function
#End If

You can find a lot of canned VBA5 equivalents at

http://support.microsoft.com/default...b;en-us;188007

They're not particularly optimized, but they work.

(One tip: MacVBA doesn't define the VbCompareMethod method constant used
in the functions at the above link, which is why I changed it to Long in
the Replace function above).



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saved Files Not Opening Cross-Platform MEAD5432 Excel Discussion (Misc queries) 0 February 7th 08 11:40 PM
Testing Reverse Compatibility and Compatibility in General dim Excel Discussion (Misc queries) 4 January 8th 08 01:02 PM
Hyperlink Screen Tips not cross platform Randy Klein Excel Discussion (Misc queries) 0 October 12th 05 08:29 AM
Cross platform worksheet issues Wallace, William Excel Worksheet Functions 1 September 21st 05 05:31 PM
VBA Macros NOT cross platform? Mike Laufer Excel Programming 3 October 14th 03 12:42 PM


All times are GMT +1. The time now is 01:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"