PDA

View Full Version : [SOLVED] Visual Basic Editor only saves the modules/project sometimes



crmpicco
05-17-2005, 04:28 AM
When using Visual Basic Editor has anyone found that it only saves the modules/project sometimes?

Picco

chitosunday
05-17-2005, 06:19 AM
Did you tried saving the file first or are you using macro recording which do not record some actions like creating macro code, editing, etc.

crmpicco
05-17-2005, 06:40 AM
no i am trying to just save the file by clicking the disk, but sometimes is works but MOST it doesnt.

i get no error, but it definately doesnt save.

why would this be?

TonyJollans
05-17-2005, 06:47 AM
I have never seen this.

Are you saying you explicitly try to save the file by clicking on the icon in the VBE (or in Excel?) and it doesn't happen? I hope not.

Are you sure you're saving the file you think you are? What does the Title Bar say? Which workbook is selected in the explorer? Before you do it, if you hover over the icon is there a tooltip telling you what it will save?

crmpicco
05-17-2005, 06:52 AM
My VBA Project is FareLoader.xla

When i hover over the disc icon (save) i get Save Fareloader.xla.

But it doesnt save...

crmpicco
05-18-2005, 03:16 AM
has it something to do with my version?

I am using MS VB 6.3.

crmpicco
05-18-2005, 04:46 AM
It also says Version 9972 and
VBA : Retail 6.4.9972

What is the problem here???

TonyJollans
05-18-2005, 06:07 AM
Sorry, I'm not ignoring your posts - I just can't help at the moment. Does it save OK if you do it through the Excel GUI instead of the VBE?

crmpicco
05-18-2005, 06:12 AM
I can save a MS Excel spreadsheet no problem. But i am just trying to save in VBE - by clicking the 'Save' disk. Not by any automatic process

crmpicco
05-18-2005, 07:30 AM
would it be because i have two spreadsheets open at the same time as VBE and trying to save it? It hasnt saved for over a day now......

sandam
05-18-2005, 08:20 AM
If you have two spreadsheets open at the same tiem and you are working in the VBE then you must be sure to have the right project selected when you save. although if you go to the spreadsheet and click save there it should save the VBE stuff as well.

HTH
Andrew;?

crmpicco
05-18-2005, 08:43 AM
the correct project is definately being selected, i click the disk and the egg-time appears for a second and then it disappears

crmpicco
05-19-2005, 01:50 AM
it saved once this morning so far, has it got anything to do with how many programs are running? i am running WinXP Pro

sandam
05-19-2005, 03:47 AM
The number of programs shouldn't affect whether you are able to save your project or not. This is a very unusual problem you have crmpicco. I have to admit its quite a stumper. I know that with Word the autosave settings sometimes come into play and it maybe the same with Excel. Would it be too much to take what you've done and paste it into a new Workbook? or try doing a save as with the current workbook and save your workbook with a different name?



Not to sure with this one

Andrew;?

crmpicco
05-19-2005, 04:38 AM
its not Excel i want to save though, it is my Visual Basic code in VBE for my VBA application. i can save a MS Excel document OK - just not my code. what can you suggest?

crmpicco
05-19-2005, 04:42 AM
others in my office experiance the same problem

Richie(UK)
05-19-2005, 05:15 AM
its not Excel i want to save though, it is my Visual Basic code in VBE for my VBA application. i can save a MS Excel document OK - just not my code. what can you suggest?
OK, just to clarify your objective here. You are not trying to save an Excel workbook or add-in. You are trying to save the VBA code contained within a module or userform in a workbook / add-in. Correct?

If so, in the VBE select Export File from the File menu. The disk icon is a shortcut for saving the whole workbook / add-in.

TonyJollans
05-19-2005, 06:24 AM
There seems to be some confusion here. The VBA project is contained within your AddIn - you cannot save one without the other. If you save from Excel the VBA project will also be saved; if you save from the VBE the worksheets will also be saved.

When you have saved your VBA Project, where are you looking to find it? What is it that makes you say it isn't saved?

crmpicco
05-19-2005, 06:29 AM
what i want to happen (an sometimes does when it works) is when i click the disk icon to save the project in VBE the project is saved. i.e. the .xla file is saved. Then when i double click the .xla file in WinExplorer the file is saved without any exporting or anything like that.

the problem here is it saves SOMETIMES - but not often.

thanks for all your help so far guys.....

crmpicco
05-19-2005, 06:30 AM
it seems to be saving everytime now, but i havent done anything...

crmpicco
05-19-2005, 06:33 AM
SOLUTION:

When i run my code and put a watch on it (anywhere) then click save it saves it.

TonyJollans
05-19-2005, 07:51 AM
Then when i double click the .xla file in WinExplorer the file is saved without any exporting or anything like that.

I'm sorry, but I don't understand what you mean by this.

crmpicco
05-20-2005, 01:38 AM
click Break then SAVE

TheAntiGates
05-20-2005, 08:41 AM
I don't know the solution but I want to confirm that what you describe does happen. I have had the same inconsistent results. However I have not tested the thought above by noting which particular project is highlighted in the Project window.

Example: Right now I can edit personal.xls Module1, and menu file/save - in the IDE, not the regular worksheet window, since it's a hidden workbook. I get an hourglass for a full second. Yet I'm still prompted to save when I close Excel. However in other scenarios I have edited a line of code for a workbook, gone file/save, closed VBE, closed Excel, and ... no prompt.

I'm as interested as you are in a solution...that is, if I indeed understand your question! Richie, I also initially interpreted it as whether to export code. The problem definition does seem garbled.

geekgirlau
05-22-2005, 06:04 PM
May I suggest a periodic export of your code? I know I've been caught in Access a couple of times as exiting the VBE does not prompt you to save, and I must have missed the save prompt when exiting the database :doh:

crmpicco
05-26-2005, 04:29 AM
the way to DEFINATELY save your code if you have this problem is:

1. Click 'BREAK' or Ctrl+Break

2. Click 'SAVE' or Ctrl+S.