losing modules, and user forms in VBeditor

S

Steve

Howdie all.
For quite some time now, I've been fidning that I'll import some bas or frm
file into my xlam file using the vb editor, and save my changes, ensuring
that the specific xlam file is active, and close the excel program out.
I then go to open it back up, and find that after getting a failed attempt
to use a macro that'd have been stored in the given module, it's not actually
in the xlam file any longer.
Thus, I'll repeat the process, sometimes two or three attempts before it
actually remains there.

So, my question.....

Is there a means by which I'd be able to retain the frm, and bas files in
the xlam, without their getting lost?

Both my colleague and I have in fact had this problem for at least 1-1/2
years now, and I for one am tired of having to deal with it. As I'm sure he
is as well.

Thank you for your inputs.
Best.
 
H

Harald Staff

I've also encountered that Save doesn't necessarily do that for addins, and
I have no idea why. Inserting a sub like this in the addin, and running it
with the play button in the VBeditor, can be assuring:

Sub SaveMe()
ThisWorkbook.Save
DoEvents
MsgBox FileDateTime(ThisWorkbook.FullName), , "Last saved"
End Sub

HTH. Best wishes Harald
 
S

Steve

Hi Harald,
Now that's an interesting idea. Thank you.
My next question, the only thing the message box says is the date, and time,
with the "Last Saved" statement.
It doesn't actually provide the workbook name, which is what I'd thought
the FileDateTime(ThisWorkbook.FullName) command performed.
For the first few times, I'd be interested in ensuring that it did indeed
save the correct file--- I know, call me paranoid. ;-)
Again, thank you.
 
H

Harald Staff

Ok try

Sub SaveMe()
ThisWorkbook.Save
DoEvents
MsgBox ThisWorkbook.FullName & vbnewline & "last saved " & _
FileDateTime(ThisWorkbook.FullName), , "I promise:"
End Sub

No reason not to be paranoid if you risk losing hours of great work to a
greedy bug. ThisWorkbook is always the file containing the running macro.

Best wishes Harald
 
S

Steve

Perfect....
Thank you.
Best.

Harald Staff said:
Ok try

Sub SaveMe()
ThisWorkbook.Save
DoEvents
MsgBox ThisWorkbook.FullName & vbnewline & "last saved " & _
FileDateTime(ThisWorkbook.FullName), , "I promise:"
End Sub

No reason not to be paranoid if you risk losing hours of great work to a
greedy bug. ThisWorkbook is always the file containing the running macro.

Best wishes Harald
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top