VBA Print sequence with CUBEMEMBER / CUBEVALUE formula's

Martin_B

New Member
Joined
Feb 2, 2015
Messages
6
Good evening,

I ham having an issue with an identical report that I have to run for 300+ locations, the report itself works perfectly but I don't want to have to save it to PDF manually. I created a VBA script to do it automatically but I am having refresh issues which are causing my script to fail.

Has anyone encountered this before and hopefully how did you solve it?

Martin
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
I have -- I remember it was a bit wonky to get it working to correctly detect the refresh is complete. But... can you be more specific on what issues you are seeing?
 
Upvote 0
I have -- I remember it was a bit wonky to get it working to correctly detect the refresh is complete. But... can you be more specific on what issues you are seeing?

The screen appears to freeze with the CUBEVALUE cells showing zeros and the CUBEMEMBER cells 'GETTING_DATA#', then the script fails. Tried every refresh code I could find and also put a 2 second wait clause in (I know not the best idea).

Martin
 
Upvote 0
Ugh. So, I looked back at my code. It was not pretty.

a) I used a lot of OnTime like: Application.OnTime Now + TimeValue("00:00:01"), "PostSlice" because... well, nothing else worked.
b) I used this whack function to know if I was "done"... again, because nothing else worked :(

Code:
Function SlicingIsComplete()
    Dim Retval
    Dim s As Worksheet
    
    For Each s In srcWorkbook.Sheets
        Set Retval = s.Cells.Find("#GETTING_DATA", LookIn:=xlValues, LookAt:=xlWhole)
        If Not Retval Is Nothing Then
            SlicingIsComplete = False
            Exit Function
        End If
    Next s
    
    SlicingIsComplete = True
End Function
 
Upvote 0
Ugh. So, I looked back at my code. It was not pretty.

a) I used a lot of OnTime like: Application.OnTime Now + TimeValue("00:00:01"), "PostSlice" because... well, nothing else worked.
b) I used this whack function to know if I was "done"... again, because nothing else worked :(

Code:
Function SlicingIsComplete()
    Dim Retval
    Dim s As Worksheet
    
    For Each s In srcWorkbook.Sheets
        Set Retval = s.Cells.Find("#GETTING_DATA", LookIn:=xlValues, LookAt:=xlWhole)
        If Not Retval Is Nothing Then
            SlicingIsComplete = False
            Exit Function
        End If
    Next s
    
    SlicingIsComplete = True
End Function

Thanks Scottsen,

This has definitely helped as the data is refreshing now, but it appears there is some of your code missing. Because now the cells that were causing an issue are updating but the actual data (cubevalue cells) are not.

I'll keep on banging my head against it, but at least I can save my files relatively easily.

Martin
 
Upvote 0
Code:
Application.OnTime Now + TimeValue("00:00:01"), "PostSlice"
Well, this was saying "in 1 second, call the function PostSlice. Which, you would need to define.

In my case I was doing a "Slice the data, create pdf, rinse, repeat". Not sure if you have a slicer or whatever, but that's the only weirdness I see in my code.
 
Upvote 0
Code:
Application.OnTime Now + TimeValue("00:00:01"), "PostSlice"
Well, this was saying "in 1 second, call the function PostSlice. Which, you would need to define.

In my case I was doing a "Slice the data, create pdf, rinse, repeat". Not sure if you have a slicer or whatever, but that's the only weirdness I see in my code.


Thanks Scottsen, I appreciate you help.
 
Upvote 0

Forum statistics

Threads
1,224,071
Messages
6,176,201
Members
452,714
Latest member
streamer1234

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