Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AutoCAD VBA - Log in when drawing is opened..

Status
Not open for further replies.

basepointdesignz

Programmer
Jul 23, 2002
566
GB
Hi peeps,

Before you read the first couple of sentences and assume this is in the wrong forum, this question is about VBA - VBA for AutoCAD - and I know this forum is for Microsoft applications but I wondered if anyone could help me - besides, I'm posting this thread on the Autodesk: AutocAD forum too..

I have a template for my survey drawing at work and from this I draw all the drawings for our customers. Want I'm itching to do is set up a VBA program that will allow me or my boss only to 'log-in' to the finished drawings and if the password is incorrect, the drawing becomes Read-Only, so that anyone trying to edit or tamper with the drawings won't be able to and able to save it over the original if they do.. Obviously, if they log-in correctly, the drawing opens up as normal and not Read-Only..

I want the log-in form to occur when the drawing loads, this way they have to log-in to edit the drawing - if they incorrectly log-in they can still study/review/look at the drawing but they won't be able to change anything..

I tried a little while ago with a log-in form that, if an incorrect log-in occurs, the drawing should close automatically (after showing a message box) but I couldn't get it to close the drawing..

I can do the code for the login form and all the correct IF/Case statements etc. but I don't know how to change the drawing to Read-Only - I've tried searching and asking about but I can't find what I need..

Also, I'm not sure exactly how to have the form load up when the drawing does. When I tried it a while ago I couldn't get the form to load upon start up, I had to manually load the macro. Does anyone know how to do this? I tried loading the program into the start-up suite but it still doesn't do it..

If anyone could give me a push or and help with what I need to know or where to look, I'd be extremely grateful!!

Thanks for listening and thanks, in advance for any help..

Renegade..
 
Where are you storing the macro?

I would suggest that you create a global routine to get and validate the password. Then, at the drawing level, you could add a macro to the files you wish to control that would call the security macro.

At the drawing level, put the call in the
AcadDocument_Activate() event. Then, from the global security routine, if the password fails, you can obtain the name and path of the active document, close it, and reopen it in Read Only mode. Note, you will have to have a check such that when it is opened again, the security routine does not run (endless loop).

Unfortunately, the only time you can specify the ReadOnly mode is when you open the drawing. Once opened, this property can not be changed.
 
I wonder if it is possible to export the file as a picture (.bmp/.gif etc.) and view it in Word or similar ?

Regards
BrianB
** Let us know if you get something that works !
================================
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top