Share via

ThisWorkbook mac vba not working

Anonymous
2015-10-23T09:59:54+00:00

I have the following vba code which is part of a user defined function, which I am trying to run on my mac:

Function Parent(NodeID As String)

Dim c As Integer

Dim r As Integer

Dim i As Integer

Dim wb As Workbook

Dim ws As Worksheet

wb = ThisWorkbook

ws = wb.Sheets("Hierarchy-Extended")

The function stops at the first line, i.e. "wb = ThisWorkbook" and in the watch window the value for wb becomes <out of context>

Can anyone help?

Thanks

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2015-10-23T14:57:56+00:00

You need:

set wb=thisworkbook

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful