-
Aug 3rd, 2021, 05:41 PM
#1
Thread Starter
Fanatic Member
Excel VBA to MAC issue
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.
Yes!!!
Working from home is so much better than working in an office...
Nothing can beat the combined stress of getting your work done on time whilst
1. one toddler keeps pressing your AVR's power button
2. one baby keeps crying for milk
3. one child keeps running in and out of the house screaming and shouting
4. one wife keeps nagging you to stop playing on the pc and do some real work.. house chores
5. working at 1 O'clock in the morning because nobody is awake at that time
6. being grossly underpaid for all your hard work
-
Aug 4th, 2021, 02:53 AM
#2
Re: Excel VBA to MAC issue
i have never had the misfortune to use vba on a mac, possibly it does not recognize vbnullstring
but maybe try
Code:
if isempty(data) then
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Aug 4th, 2021, 03:10 AM
#3
Thread Starter
Fanatic Member
Re: Excel VBA to MAC issue
I am using vbnullstring throughout the code, but it maybe that its just not doing what i think it is. the other times im using it is setting a value, maybe the if statement is affecting it somehow..... not sure.
I will give your suggestion a try
Thanks
Yes!!!
Working from home is so much better than working in an office...
Nothing can beat the combined stress of getting your work done on time whilst
1. one toddler keeps pressing your AVR's power button
2. one baby keeps crying for milk
3. one child keeps running in and out of the house screaming and shouting
4. one wife keeps nagging you to stop playing on the pc and do some real work.. house chores
5. working at 1 O'clock in the morning because nobody is awake at that time
6. being grossly underpaid for all your hard work
-
Aug 4th, 2021, 12:55 PM
#4
Re: Excel VBA to MAC issue
It might be time to actually test your application on a Mac so you can see what the error is and where it occurs. For this, you either need a Mac for testing, which might not be a bad idea if you have customers that use them with your application. Or, an only Mac VM might be the way to go:
https://www.macincloud.com/
-
Aug 5th, 2021, 09:34 AM
#5
Thread Starter
Fanatic Member
Re: Excel VBA to MAC issue
i would love to have a VM setup, but i just dont have resources for this kind of thing, and this is the first time i worked on Mac/Office setup. The guy actually stopped replying to me, i was hoping we could work together to fix this problem using his mac but it seems he's 'To Busy' to fix his own problem :/. i am not wasting my time on this any longer for the time being. thanks for your input.
EDIT****
i just saw your link macincloud, ill have a look at that, thanks.
Yes!!!
Working from home is so much better than working in an office...
Nothing can beat the combined stress of getting your work done on time whilst
1. one toddler keeps pressing your AVR's power button
2. one baby keeps crying for milk
3. one child keeps running in and out of the house screaming and shouting
4. one wife keeps nagging you to stop playing on the pc and do some real work.. house chores
5. working at 1 O'clock in the morning because nobody is awake at that time
6. being grossly underpaid for all your hard work
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|