Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15083

Excel VBA to MAC issue

$
0
0
Hi

Im working on a project that is driving me a little loopy, im developing a very simple macro using very basic vba code and it works fine on my side but it just doesnt want to 100% work on a MAC, most of it does but i keep hitting little problems that come down to i think "Why are you running office on a MAC" haha.

anyway i have 2 questions, is there anything i should note when trying this in the future, what works and what doesnt work tips and second is my actual problem right now.

my error occurs in a part of my code that reads a cell from a sheet, if its empty or vbnullstring i convert is to '(empty)' to display in a combobox. due to my client being to busy to answer my questions i narrowed it down to a block of code which is all very basic stuff so im confused why the error is appearing here.

Code:

Private Function ChangeNullstrings(data As String, ChangeTo As String) As String
    If data = vbNullString Then
        ChangeNullstrings = ChangeTo
    Else
        ChangeNullstrings = data
    End If
End Function

Code:

Private Sub Init_AbstractValues()
    'the user selected data
    cmbUserInput1.Text = ChangeNullstrings(Data_1, "(empty)")
    cmbUserInput2.Text = ChangeNullstrings(Data_2, "(empty)")
    cmbUserInput3.Text = ChangeNullstrings(Data_3, "(empty)")
    cmbUserInput4.Text = ChangeNullstrings(Data_4, "(empty)")
    cmbUserInput5.Text = ChangeNullstrings(Data_5, "(empty)")
    cmbUserInput6.Text = ChangeNullstrings(Data_6, "(empty)")
    cmbUserInput7.Text = ChangeNullstrings(Data_7, "(empty)")
    cmbUserInput8.Text = ChangeNullstrings(Data_8, "(empty)")
    cmbUserInput9.Text = ChangeNullstrings(Data_9, "(empty)")
    cmbUserInput10.Text = ChangeNullstrings(Data_10, "(empty)")
    cmbUserInput11.Text = ChangeNullstrings(Data_11, "(empty)")
    cmbUserInput12.Text = ChangeNullstrings(Data_12, "(empty)")
    cmbUserInput.Text = ChangeNullstrings(DataInput, "(empty)")
    txtFreeText.Text = ChangeNullstrings(AbstractFreeText, "(empty)")
    cmbS1.Text = ChangeNullstrings(SentenceData_1, "(empty)")
    cmbS2.Text = ChangeNullstrings(SentenceData_2, "(empty)")
    cmbS3.Text = ChangeNullstrings(SentenceData_3, "(empty)")
    cmbS4.Text = ChangeNullstrings(SentenceData_4, "(empty)")
    cmbS5.Text = ChangeNullstrings(SentenceData_5, "(empty)")
       
End Sub

the error is happening somewhere in here and im dumbfounded. surely a MAC can get these parts right!!??

any ideas whats going on?

The error code i got lead me to this location so its somewhere here in this code. This entire macro works fine on a windows pc its just the MAC its not running on.

Viewing all articles
Browse latest Browse all 15083

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>