This may be a long shot but...I have a couple spreadsheet macros and thanks to the help of the fine folks on this forum they all work fine in Excel 2007 and 2010. My user received a MAC for christmas with Office for MAC 2011. None of my scripts work on his MAC. I did some research and VBA is supposed to be supported in that version.
So for starters, does anyone know some code I can add to the front end of the scripts that will determine whether it is running on a MAC or a PC so I can differentiate different segments of code for each? I would like it to work on both.
Secondly I suspect that at least two of my scripts do not work because of something to do with file/folder structure differences. Here is one of those scripts:
Sub ImportINV()
'
' ImportINV Macro
' Imports inventory from last month's file
'
'
Dim sPath As String
Dim fName As String
Dim s As String
Dim Wk1 As String
Dim Wk2 As String
Wk1 = ActiveWorkbook.Name
s = CurDir
sPath = ThisWorkbook.Path
ChDir sPath
MsgBox ("Please select the spreadsheet from the previous period that you want to import the data from.")
fName = Application.GetOpenFilename( _
Filefilter:="XLSM Files (*.XLSM),*.XLSM")
ChDrive s
ChDir s
If LCase(fName) = "false" Then Exit Sub
Workbooks.Open Filename:=fName
Wk2 = ActiveWorkbook.Name
Sheets("Sheet2").Select
Range("L3:L524").Select
Selection.Copy
Windows(Wk1).Activate
Sheets("Sheet2").Select
Range("E3:E524").Select
Selection.PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
Windows(Wk2).Activate
Sheets("Sheet2").Select
Range("D3:D524").Select
Selection.Copy
Windows(Wk1).Activate
Sheets("Sheet2").Select
Range("D3:D524").Select
Selection.PasteSpecial Paste:=xlValues
Windows(Wk2).Activate
Application.CutCopyMode = False
ActiveWorkbook.Close SaveChanges:=False
End Sub
So all this does is allow you to select another spreadsheet and it copies some of the data from that spreadsheet to the current one.
Here is an additional problem for me, currently I have no access to a MAC with Office for MAC 2011 to use for testing to figure out how to fix this. Which also unfortunately means I do not know off hand where it is failing. I am working on getting something I can use for testing and development on this but since I am not really willing to put out money to buy my own copies of OS X and Office for MAC 2011 to resolve this issue that may not happen.
If by some miracle someone who does have said operating system and Office version looks at this and knows what's wrong, I would surely appreciate a version of this code that runs on MAC. I believe I could then modify at least one of the other scripts and get it working as well.
All help or suggestions appreciated.
Bookmarks