Switch PDM User by macro

Dear all;

I want to create a marco for easy switch between 2 PDM users.
One user is my 'normal' user (username and password) the other isthe pdmwadmin (also proteted by password).

I've already found the syntaxes for logging out and logging in.

Login out:
Dim instance As IPDMWConnection
instance.Logout()

Log in:
Dim instance As IPDMWConnection
Dim user As String
Dim password As String
Dim server As String
Dim request_port As Integer
Dim data_port As Integer
Dim value As Integer
value = instance.Login(user, password, server, request_port,data_port)


It appears Iám an abolute Noob in programming macro's. Cansomeone help me?

My goal is to create one button. When I click it, SW checks whatusername is active, and after that activets the other user namen.If that isn't possible (or too difficult) I will also accept 2buttons (one for switching to pdmwadmin, the other to swich to mynormal username)

If anyone will be that nice for helping me so I can create thismarco (or perhaps write the complete marco for me :F )

Thank you very much!SolidworksApi macros