Need some help with macro
I have a basic macro that does some things in calc, it works fine but if i open a writer doc it of course crashes. In looking at the ThisComponent i see it has a Title property so i thought, ok, if its the wrong title i will just exit the macro, but no amount of twiddling will let me test this property
Code:
Function PortfolioGain() as Currency
Dim doc As Object
Dim sheet As Object
Dim sum as Variant
doc = ThisComponent
if doc.CurrentController.Title != "Stocks.ods" Then
Exit Function
Endif
I also just noticed that when writer is open and the foreground window that doc (ThisComponent) appears to be null, so i tried this test
but that also doesnt work.
Code:
doc = ThisComponent
if IsNull(doc) then
Exit Function
endif
What i need to do is to only proceed in the macro if the spreadsheet 'Stocks.ods' is the active sheet
Can anyone suggest a simple test i could use?
Turkey Creek Jack Johnson: Nobody move!
Doc Holliday: Nonsense. By all means, move.