PDA

View Full Version : Solved: Lost macros in Word Document



DonCard
05-23-2006, 02:03 PM
I have a word doc with a number of macros that I uploaded to a server and was downloaded by a colleague. When the colleague went to run the macros, they did not function. The macros were listed but when edit was chosen only the title and comment text was there, no macro code. Any ideas as to what's happening here?

fumei
05-23-2006, 05:09 PM
Uh...no. It was a .DOC file, not a .DOT file...correct?

What is there when you actually look at the code in the VBE?

DonCard
05-24-2006, 06:59 AM
Was a .DOC file. There is no code...it is gone. The macros are listed when Tools-macros selected but when edit is chosen the only text visible is a comment section I wrote describing the macros functions.

I thought it might be a problem with the macro security settings on my colleagues machine but those were changed and the doc downloaded again with the same result.

fumei
05-24-2006, 06:38 PM
Just want to be sure here. So when you open the VBE and look in the code module containing the macros, you see:

Sub macroname()
' blah blah blah comment

End Sub

Right?

DonCard
05-25-2006, 08:30 AM
Almost. No End Sub. Just:

Sub macroname()
'blah blah blah comment...

Everything else is gone.

fumei
05-25-2006, 09:44 AM
You have to be kidding. OK, next question.

Is there more than one macro in this file? If there is, are you saying it looks like:

Sub macroname1()
'blah blah blah comment...

Sub macroname2()
'blah blah blah comment...

Sub macroname3()
'blah blah blah comment...

And are you saying these are in fact listed in Tools > Macro > Macros?

This is bizarre. Never heard of such a thing.

TonyJollans
05-25-2006, 03:52 PM
I agree - this is bizarre and sounds like corruption. Any chance you could upload the document here?

fumei
05-25-2006, 10:49 PM
I can NOT see how a macro can be listed in Tools > Macro > Macros if it does not have an End Sub.

Ooooops. I stand corrected. Indeed you can have a macro listed as a macro with no End Sub. I wrote one, removed the end sub, and saved it. Reopened the file, and yes the macro name IS listed, even though there is no End Sub.

Hmmmm. OK. But that still does not help with why the code lines are removed...assuming they were in fact there in the first place.

Yeah, can you post the file?

DonCard
05-26-2006, 09:45 AM
I am not sure what was going on with the macros being listed but not really there, but the problem has been solved. The security settings on my colleages computer were reset and the document reloaded. The macros were present, complete and working. Thanks for the responses.

fumei
05-26-2006, 10:38 AM
Frankly...that is even more bizarre. I am still scratching my head that actual TEXT of macro code would be missing...and reappear. In fact, I can really believe it. I can not see how changing security setting would make text reappear. Something else was going on. However, if it is working now...good.