Public variable in shared workbook

Starkey

Board Regular
Joined
May 5, 2006
Messages
187
Hey guys

I'm looking to build a workbook that'll be added to a shared network. I also plan to allow different users to access the workbook at the same time

The workbook will include VBA and in that a number of public variables. Am I right in thinking that each PC on the network would store their own set of values for the public variables and this won't be overwritten when the workbook is saved?

Eg when a user logs on there is a public variable that captures the ID of the users. This value will obviously be different for each user using the spreadsheet. Will a save of the workbook reset the value of the public variable to the same value for everyone logged on?

Hope that makes sense (bet it doesn't!)

Cheers
Starkey
 

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 think that each user's public variable will be held locally.

I cannot test this right now but an interesting question :)
 
Upvote 0
Starkey

Why not just try it and see?

I've tried to find something on this topic but there seems to be nothing.

I did come across one posted on another Excel/VBA forum that was basically the same.

It was posted in 2008 and never answered.:)

PS Have you checked all the other <strike>problems</strike> limitations of shared workbooks? I think code might be affected.
 
Upvote 0
The public variables are held within each instance of a shared workbook and persist through saves.
[made perfect sense, btw]
 
Upvote 0
Thanks everyone for coming back to me.

Unfortunately I can't test because I haven't the shared network in place but I'm reassured but tweedle's response

You've got me worried now norie, looks like I have to do some more reading up! I've thought of a way of preventing 2 users accessing the same record in the form and other than the public variable question I thought I had all bases covered!

Cheers
Starkey
 
Upvote 0
Starkey

Sorry about that.

You can probably ignore me - I've kind of got a dislike of shared workbooks after a bad experience.

That was some time ago so I'm sure it's different now.:)
 
Upvote 0
Ha no worries. It worries the hell out of me but I'm going to bite the bullet as it'll be worth it.

The only thing that worries me is the strange behaviour at times when I run the ActiveWorkbooks.Save command when a form is open. Ive lost the values stored as public variables doing that before. But I know enough about coding by now to know that it's always something I've done wrong, it's never excel!

Cheers
Starkey
 
Upvote 0
Good luck.:)

Just make sure you back up all your data or preferably try things out with dummy data/workbooks.
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,134
Members
452,890
Latest member
Nikhil Ramesh

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