0

this is my First question.

I'm trying to declare a global variable in MS Project like I do in Excel. It doesn't work? Can someone explain why it does not work that way. Even better why my solution is working?

My way to declare a Global Variable (Only works for the current userform or module)

This is in ProjectGlobal(global.mpt)

'ThisGlobal(global.mpt)
Public ATP As Project 

This is in VBAProject(FileName.mpt)

'my Userform where I use PTP
Public PTP As New Project 

For me it makes no sense, that this works. Testet it in Excel, doesnt work.

Edit: Only declare the variable in a Module!

  • It is unclear what you are asking. However, if your question is about scope, read this: [Having a public variable available in userform / sheet objects](https://stackoverflow.com/questions/40073952/having-a-public-variable-available-in-userform-sheet-objects). – Rachel Hettinger Sep 01 '21 at 14:19
  • Thank you, it helped a lot @RachelHettinger – Lukas Schmölzl Sep 01 '21 at 14:56

0 Answers0