byVal sheetname as Variant

df9864

Board Regular
Joined
Sep 28, 2004
Messages
108
The following code works OK - this essentially triggers an Essbase Zoom event on cell "A4" on worksheet "2. Retrieve":

Declare Function EssVZoomIn Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal range As Variant, ByVal selection As Variant, ByVal level As Variant, ByVal across As Variant) As Long

Sub ZoomData()

X = EssVZoomIn("2. Retrieve", Null, range("A4"), 2, False)
If X = 0 Then
MsgBox ("Zoom successful.")
Else
MsgBox ("Zoom failed.")
End If

End Sub


However, within the VBA module I've named the worksheet "2. Retrieve" as wkRetrieve
How do I replace the worksheet name (in the workbook) with the worksheet name I've defined in the background. Everything I've done seems to give me errors (eg. replacing the declaration with sheetname as object or byval to byref, etc....

I'd be hugely grateful for a solution as my small brain cannot figure this out.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
I think you want this?

Code:
[I]X = EssVZoomIn(wkRetrieve.Name, Null, range("A4"), 2, False)[/I]
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top