Shape Sheet Values from WIndows registry

Started by mmulvenna, February 27, 2009, 10:26:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mmulvenna

I have a user cell called user.part_name

The value of this cell is stored in the windows registry.

I have vba function to retrieve the value from the registry and it works fine when I run it from the vb code.

How do run the function from the shapesheet cell.

I have tried to set user.part_name = runaddon(projectname.modulename.function, param1, param2) but it does not retrive the value. I have also tried the callthis function with the same results
When I view the value rather than the formula it show "False" as the value

As alwasy any help is appreceiated.

Old man Mike :D

mmulvenna

Okay here is an update. the user.part_name has this formula =CALLTHIS("GetJTFRegistry(""Part A"", ""\Toekick Part Names\Base"")")


If I remove the passed parameters in the cell formula, I get the message box
this is the VBA codePublic Function GetJTFRegistry(optional registryname, Optional tree) As String
    MsgBox "Got Here"
    Dim answer
    answer = GetRegistryValue(HKEY_CURRENT_USER, "Software\JTFinneran\Frameless Cabinets" + tree, registryname, REG_SZ)
    GetJTFRegistry = answer
End Function


This is the code that does the initialize of form fields in the vbs code that works just fine.Private Sub UserForm_Initialize()
' these fields are the part names contained in the windows registry

    txtbaseparta = GetJTFRegistry("Part A", "\Toekick Part Names\Base")
    txtbasepartb = GetJTFRegistry("Part B", "\Toekick Part Names\Base")
    txtbasepartc = GetJTFRegistry("Part C", "\Toekick Part Names\Base")
    txtbasepartd = GetJTFRegistry("Part D", "\Toekick Part Names\Base")
    txtbaseparte = GetJTFRegistry("Part E", "\Toekick Part Names\Base")
    txtbasepartf = GetJTFRegistry("Part F", "\Toekick Part Names\Base")


As always any help is appreceiated

mmulvenna

Update 2

From the SDK

"The CALLTHIS function always evaluates to 0, and the call to procedure occurs during idle time after the recalculation process finishes. Procedure can return a value, but Visio ignores it. Procedure returning a value that Visio can recognize by setting the formula or result of another cell in the document, but not the cell that called procedure unless you want to overwrite the CALLTHIS formula."



So any ideas on how I can do this?

Guess I will try to put a formula in the scratch section to update the user.part_name cell. Do I use the SETF with something else? not quite sure i understand SETF and GETREF. Will do some digging..... :'( :'( :'(

Thanks Again
Mike

Paul Herber

If you pass the cell reference to your VBA routine then the VBA can set the cell to the new value.

Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

mmulvenna

Thanks, I will give it a shot. Thanks for the recommendation.