problem with visual basic

G

Guest

it seems that everytime i open excel 2003 , a window appear saying
compilation error: incorrect instruction outside a procedure. .. i hit the ok
button and i can continue working as usual... i turn off excel program and it
appears again. what should i do ,, i dont even know where it comes from...
help me please..
 
G

Guest

There is probably a stray line of code in one of the VBA Modules. This could
happen if someone creates a macro or starts to create a macro but doesn't put
the code inside a subroutine or function.

Open Excel and goto the Visual Basic Editor by hitting Alt-F11. Then, from
the "Debug" menu select "Compile VBA Project". You can delete the offending
line of code or simply comment it out by placing an apostrophe (') before it.
 
G

Guest

Thank you very much Dave W but it seems that the only things that happen is
that each time i open excel, the windows that opens has a green mark on the
word true in the first line.. does it means that it is the word that i should
correct or the error might be anywhere into the text? till now i tried a few
things with what you told me without result :(
 
G

Guest

Could you copy here the content of that window?
Regards,
Stefi


„Sheila†ezt írta:
 
G

Guest

Does it happen with every workbook you open or just a specific one? If it's
every one the it's possible that the problem is in an add-in. You could try
to remove add-in's from the menu by selecting Tools then Add-Ins and
unchecking each add-in. Remember the ones that are checked so you can add
them back if you need to.

I'm not too clear what you mean by "a green mark on the word true". Is this
in a worksheet or in the Visual Basic editor. I would guess it's the visual
basic editor but if that's the case then green text represent comments -
which are harmless - and I don't know what a green mark is. Maybe you can
describe it more. It might also help if you could include the exact text of
the title of the active window. for example, "Microsoft Visual Basic - Book 1
[Sheet 1 (Code)]".

As the next poster says, if you have any code to post it will also help.

- Dave
 
N

Nick Hodge

Sheila

I suspect you have a faulting add-in,likely one installed with Adobe Acrobat

Go to Tools>Add-ins...a nd uncheck everything here. Add them back one by
one, re-starting Excel between and see which one brings the issue back.

If none of these do, then try un-installing acrobat and see if that fixes
it. If it does, download and install the latest version

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
(e-mail address removed)
 
G

Guest

that is the text i have appearing each time i open excel.. and it say in
another window inside that window ''compilation error'' incorrect instruction
outside a procedure and then ok or help........ i'm getting desperate
lol.....and Dave yes it does happen everytime i open excel... and the green
mark i was talking about is the word true on this first line (at the end) is
highlighten.....thanks again for your help everyone,,, very precious to me...

Application.CommandBars("Borders").Visible = vrai
Application.CommandBars("Borders").Visible = False
Application.CommandBars("Compare Side by Side").Visible = True
Application.CommandBars("Compare Side by Side").Visible = False
Application.CommandBars("Exit Design Mode").Visible = True
Application.CommandBars("Exit Design Mode").Visible = False
Application.CommandBars("Drawing").Visible = True
Application.CommandBars("Diagram").Visible = True
Application.CommandBars("Diagram").Visible = False
Application.CommandBars("External Data").Visible = True
Application.CommandBars("External Data").Visible = False
Application.CommandBars("Forms").Visible = True
ActiveSheet.OptionButtons.Add(351.75, 57, 72, 72).Select
Range("G9").Select
ActiveSheet.CheckBoxes.Add(369.75, 84, 72, 72).Select
Range("G10").Select
ActiveSheet.CheckBoxes.Add(371.25, 122.25, 72, 72).Select
Range("G13").Select
ActiveSheet.CheckBoxes.Add(360, 153, 72, 72).Select
Columns("G:G").Select
Selection.Delete Shift:=xlToLeft
Columns("E:E").ColumnWidth = 12.57
Columns("F:H").Select
Selection.ClearContents
Selection.ClearContents
Selection.ClearContents
Selection.ClearContents
Selection.ClearContents
Selection.ClearContents
Selection.ClearContents
Range("J7").Select
ActiveSheet.CheckBoxes.Add(198, 47.25, 72, 72).Select
Application.CommandBars("Formatting").Visible = True
Application.CommandBars("Standard").Visible = True
Application.CommandBars("Exit Design Mode").Visible = True
Application.CommandBars("Exit Design Mode").Visible = False
Application.CommandBars("Diagram").Visible = True
Application.CommandBars("Diagram").Visible = False
Application.CommandBars("Chart").Visible = True
Application.CommandBars("Picture").Visible = True
Application.CommandBars("Chart Menu Bar").Visible = True
Application.CommandBars("Chart Menu Bar").Visible = False
Application.CommandBars("Control Toolbox").Visible = True
Selection.Delete
Range("H6").Select
ActiveSheet.OLEObjects.Add(ClassType:="Forms.ComboBox.1", Link:=False, _
DisplayAsIcon:=False, Left:=414.75, Top:=243.75, Width:=23.25,
Height _
:=12).Select
Range("G19:H19").Select
ActiveSheet.Shapes("ComboBox1").Select
Range("G25").Select
ActiveSheet.Shapes("ComboBox1").Select
Range("F18").Select
ActiveSheet.Shapes("ComboBox1").Select
Selection.Delete
Range("H13").Select
ActiveWindow.Close
Application.CommandBars("Stop Recording").Visible = False
Workbooks.Add
Range("C11").Select
ActiveSheet.OLEObjects.Add(ClassType:="Forms.ComboBox.1", Link:=False, _
DisplayAsIcon:=False, Left:=145.5, Top:=133.5, Width:=72,
Height:=18) _
.Select
Selection.ShapeRange.ScaleWidth 1.58, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 2.38, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleWidth 0.24, msoFalse, msoScaleFromTopLeft
Range("C7").Select
ActiveSheet.OLEObjects.Add(ClassType:="Forms.TextBox.1", Link:=False, _
DisplayAsIcon:=False, Left:=153, Top:=144.75, Width:=72,
Height:=18). _
Select
Range("D16").Select
ActiveSheet.Shapes("TextBox1").Select
Selection.ShapeRange.IncrementLeft 98.25
Selection.ShapeRange.IncrementTop 1.5
ActiveSheet.Shapes("ComboBox1").Select
Range("B11").Select
ActiveSheet.Shapes("ComboBox1").Select
Range("C15").Select
ActiveWindow.Close
Workbooks.Add
ActiveSheet.OLEObjects.Add(ClassType:="Forms.CheckBox.1", Link:=False, _
DisplayAsIcon:=False, Left:=69, Top:=27, Width:=42.75, Height:=6). _
Select
Range("B4").Select
ActiveSheet.OLEObjects.Add(ClassType:="Forms.CheckBox.1", Link:=False, _
DisplayAsIcon:=False, Left:=75, Top:=45, Width:=108, Height:=19.5). _
Select
Range("B6").Select
ActiveSheet.OLEObjects.Add(ClassType:="Forms.CheckBox.1", Link:=False, _
DisplayAsIcon:=False, Left:=78.75, Top:=70.5, Width:=108, Height:= _
19.5).Select
Range("B9").Select
Application.WindowState = xlMinimized
 
G

Guest

i forgot.... that window in excel says on top,,,microsoft visual
basic-PERSO.XLS
and at the top of the smaller window it says PERSO .XLS module 1(code)


????????
 
G

Guest

Sheila said:
I DID FIX MY PROBLEM BY OPENING EXCEL/ VISUAL BASIC/ FICHIER/ SUPPRIMER MODULE 1 AND VOILA..... THANK YOU VERY MUCH FOR YOUR HELP GUYS, I REALLY APPRECIATE IT. SHEILA
 
G

Guest

Hello, again.
One more thing to try... until I can think of something else... is to move
the personal.xls file (and any other files) from the XLStart folder. The
location should be something like this:
C:\Program Files\Microsoft Office\OFFICE11\XLSTART but it may differ
depending on your version of Office. You can always just search for PERSO.XLS
or XLStart by right-clicking on the drive icon from Windows Explorer.

Anyway, once you find that workbook then move it to another directory that
is not called XLStart. then close and re-open Excel and see if it happens
again. The personal.xls file is one that contains personal macros. Even
though your file is called perso.xls and not personal.xls if it is in the
XLStart directory for your computer it will load and if it contains an error
then that could account for the issue you're having.

If I can think up another suggestion I'll let you know.

- Dave
 
G

Guest

Hi again Dave and thank you so much for you help... but i did fixed my
problem yesterday by deleting the module in visual basic/folder/ delete
module wich i did not know i could do so i did and then ''BAM'' everything
just desepeared and never came back,,, i'm glad....

I'll get back to have news from you....
sheila
 

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