Cardenas,
Maybe better ask at the Macintosh forum also. This forum is heavily Windows based.
It could have to do something with filenames and separators. This little piece of code:
Case Is = "Macintosh"
DIR_SEPERATOR = ":"
Case Else
DIR_SEPERATOR = "\"
End Select
I suppose you didn't write this yourself. Why don't you ask the maker of the software?
Hope this helps.
Kees
Hi I'm using a Microsoft document on a Mac that has macros
it works fine in OS 9 environment but does not work in OS X.
I'm wondering if it's the syntx that has changed and it can't understand it in OS X since OS X is unix based.
Here is the macro code, what happens if you try to run the macro it
crashes word.
Ohh I just tested in Windows 2000 and it works fine there.
----AwardUpdater Macro - modMain (Code) ----------------
Option Explicit
Global CHECKMARK_COUNT_COLUMN As String
Global BGRP_MESSAGES_COLUMN As String
Global FUND_MESSAGES_COLUMN As String
Global CHECKMARK_HEADER As String
Global CHECKMARK_TOKEN As String
Global MERGE_FOLDER As String
Global MERGE_LIST As Variant
Global DIR_SEPERATOR As String
Sub RunMergeUpdater()
Call SetGlobals
Call UpdateMergeList
frmMain.Show
End Sub
Sub SetGlobals()
Select Case ThisDocument.Application.System.OperatingSystem
Case Is = "Macintosh"
DIR_SEPERATOR = ":"
Case Else
DIR_SEPERATOR = "\"
End Select
CHECKMARK_COUNT_COLUMN = "AWARD_DESC"
BGRP_MESSAGES_COLUMN = "BGRP_MESSAGES"
FUND_MESSAGES_COLUMN = "FUND_MESSAGES"
CHECKMARK_HEADER = "CHECKMARK_COL"
CHECKMARK_TOKEN = "[ ]"
MERGE_FOLDER = ThisDocument.Path & DIR_SEPERATOR & "merge" & DIR_SEPERATOR
MERGE_LIST = Array()
End Sub
Function SplitLine(ByVal LineData As String, ByVal Delimiter As String) As Variant
Dim Temp As String
Dim TempArray As Variant
LineData = Delimiter & LineData
TempArray = Array()
Do While Trim(LineData) <> ""
If InStr(Len(Delimiter) + 1, LineData, Delimiter) < 1 Then
Temp = Right(LineData, Len(LineData) - Len(Delimiter))
LineData = ""
Else
Temp = Mid(LineData, 1, InStr(Len(Delimiter) + 1, LineData, Delimiter) - 1) 'Len(Delimiter))
Temp = Right(Temp, Len(Temp) - Len(Delimiter))
LineData = Mid(LineData, InStr(Len(Delimiter) + 1, LineData, Delimiter))
End If
ReDim Preserve TempArray(UBound(TempArray) + 1)
TempArray(UBound(TempArray)) = Temp
Loop
SplitLine = TempArray
End Function
Function JoinArray(ByVal TempArray As Variant, ByVal Delimiter As String) As String
Dim Index As Variant
If UBound(TempArray) < 0 Then
JoinArray = ""
Exit Function
End If
For Each Index In TempArray
JoinArray = JoinArray & Index & Delimiter
Next Index
JoinArray = Left(JoinArray, Len(JoinArray) - Len(Delimiter))
End Function
Function InStrReverse(ByVal StringCheck As String, ByVal StringMatch As String, Optional ByVal Start As Integer = -1) As Integer
If Len(StringCheck) = 0 Then
InStrReverse = 0
Exit Function
End If
If IsNull(StringCheck) Then
InStrReverse = Null
Exit Function
End If
If Len(StringMatch) = 0 Then
InStrReverse = Start
Exit Function
End If
If InStr(1, StringCheck, StringMatch) < 1 Then
InStrReverse = 0
Exit Function
End If
If Start > Len(StringMatch) Then
InStrReverse = 0
Exit Function
End If
Dim Index As Variant
Dim Temp As Variant
Dim CharData As String
Dim ReverseCheck As String
Dim ReverseMatch As String
Temp = StringCheck
For Index = 0 To Len(Temp)
If Temp = "" Then Exit For
CharData = Mid(Temp, 1, 1)
Temp = Right(Temp, Len(Temp) - 1)
ReverseCheck = CharData & ReverseCheck
Next Index
Temp = StringMatch
For Index = 0 To Len(Temp)
If Temp = "" Then Exit For
CharData = Mid(Temp, 1, 1)
Temp = Right(Temp, Len(Temp) - 1)
ReverseMatch = CharData & ReverseMatch
Next Index
InStrReverse = Len(ReverseCheck) - InStr(1, ReverseCheck, ReverseMatch)
End Function
Function StrReplace(ByVal StartString As String, ByVal SearchString As String, ByVal ReplaceString As String) As String
If IsNull(StartString) = True Then
StrReplace = Null
Exit Function
End If
If IsNull(SearchString) = True Then
StrReplace = Null
Exit Function
End If
If Len(StartString) = 0 Then
StrReplace = StartString
Exit Function
End If
If Len(SearchString) = 0 Then
StrReplace = StartString
Exit Function
End If
Dim SearchLoc As Integer
SearchLoc = 1
While InStr(SearchLoc, StartString, SearchString) <> 0
Dim LeftPart As String
Dim RightPart As String
Dim Location As Integer
'replace string with what we need to
Location = InStr(1, StartString, SearchString)
LeftPart = Left(StartString, Location - Len(SearchString))
RightPart = Right(StartString, Len(StartString) - Location)
StartString = LeftPart & ReplaceString & RightPart
SearchLoc = Len(LeftPart) + Len(ReplaceString)
Wend
StrReplace = StartString
End Function
Sub UpdateMergeList()
Dim File As String
Dim Index As Object
Dim HeaderList As Variant
File = Dir(MERGE_FOLDER)
frmMain.lstMergeFiles.Clear
While File <> ""
HeaderList = GetHeader(MERGE_FOLDER & File)
If HeaderUpdated(HeaderList) = True Then File = File & " [Updated]"
If HeaderCountColPresent(HeaderList) = False Then File = File & " [Missing Column]"
frmMain.lstMergeFiles.AddItem File
File = Dir
Wend
'Select the first file if there are any
frmMain.lstMergeFiles.ListIndex = -1
If frmMain.lstMergeFiles.ListCount > 0 Then
frmMain.lstMergeFiles.ListIndex = 0
End If
End Sub
Function GetHeader(FilePath As String) As Variant
Dim FileH As Integer
Dim LineData As String
Dim InputChar As String
FileH = FreeFile
Open FilePath For Input Access Read As FileH
Do While Not EOF(FileH)
InputChar = Input(1, #1)
If InputChar = Chr(10) Then Exit Do
LineData = LineData & InputChar
Loop
Close FileH
'Get and spit header list
GetHeader = SplitLine(LineData, ",")
End Function
Function HeaderCountColPresent(HeaderList As Variant) As Boolean
Dim Index As Integer
HeaderCountColPresent = False
For Index = 0 To UBound(HeaderList)
If HeaderList(Index) = CHECKMARK_COUNT_COLUMN Then
HeaderCountColPresent = True
Exit For
End If
Next Index
End Function
Function HeaderUpdated(HeaderList As Variant) As Boolean
If HeaderList(UBound(HeaderList)) = CHECKMARK_HEADER Then
HeaderUpdated = True
Else
HeaderUpdated = False
End If
End Function
Sub UpdateMergeFile(MergePath As String, MergeFileName As String)
Dim MergeFileH As Integer
Dim FixedFileH As Integer
Dim LineData As String
Dim CountColumnIndex As Integer
Dim BGRPColumnIndex As Integer
Dim FUNDColumnIndex As Integer
Dim HeaderList As Variant
Dim RowData As Variant
Dim Index As Variant
Dim JIndex As Variant
Dim Temp As Variant
'Get mergefile handle and read in all data
MergeFileH = FreeFile
Open MergePath & MergeFileName For Input Access Read As MergeFileH
While Not EOF(MergeFileH)
LineData = LineData & Input(1, #1)
Wend
Close MergeFileH
'Get header list
HeaderList = SplitLine(Mid(LineData, 1, InStr(1, LineData, Chr(10)) - 1), ",")
'Locate Column last column with heading to assign values to
CountColumnIndex = -1
BGRPColumnIndex = -1
For Index = 0 To UBound(HeaderList)
If HeaderList(Index) = CHECKMARK_COUNT_COLUMN Then
CountColumnIndex = Index
End If
If HeaderList(Index) = BGRP_MESSAGES_COLUMN Then
BGRPColumnIndex = Index
End If
If HeaderList(Index) = FUND_MESSAGES_COLUMN Then
FUNDColumnIndex = Index
End If
Next Index
'Append new header
ReDim Preserve HeaderList(UBound(HeaderList) + 1)
HeaderList(UBound(HeaderList)) = CHECKMARK_HEADER
'Snip off Header information, leading chr(10)", and trailing "chr(10)
LineData = Mid(LineData, InStr(1, LineData, Chr(10)) + 2)
LineData = Left(LineData, Len(LineData) - 2)
'Populate RowData
Temp = SplitLine(LineData, """" & Chr(10) & """")
ReDim RowData(UBound(Temp))
For Index = 0 To UBound(Temp)
RowData(Index) = SplitLine(Temp(Index), """,""")
Next
Temp = Empty
'BEGIN MODIFICATION OF DB DUMP
'PART I - Append checkmark to each entry in RowData
For Index = 0 To UBound(RowData)
'Add column for checkmarks
Temp = RowData(Index)
ReDim Preserve Temp(UBound(Temp) + 1)
RowData(Index) = Temp
'Make array for count col data
Temp = SplitLine(RowData(Index)(CountColumnIndex), Chr(11))
For JIndex = 0 To UBound(Temp)
Temp(JIndex) = CHECKMARK_TOKEN
Next
RowData(Index)(UBound(RowData(Index))) = JoinArray(Temp, Chr(11))
Next
Temp = Empty
'Part II - WordWrap BGRP_MESSAGES
For Index = 0 To UBound(RowData)
'Replace all line returns with double spaces
RowData(Index)(BGRPColumnIndex) = StrReplace(RowData(Index)(BGRPColumnIndex), Chr(11), " ")
Next
'Part III - Add bullets to FUND_MESSAGES
For Index = 0 To UBound(RowData)
'Replace all line returns with double spaces
RowData(Index)(FUNDColumnIndex) = "

Chowhound
Comic Vine
GameFAQs
GameSpot
Giant Bomb
TechRepublic