compile error

F

Fraggs

What does it mean when it says -
Complie error:
Invlid Outside Procedure

How do I fix this
 
C

Chip Pearson

It means that whatever is highlighted (e.g., an external function
declaration) cannot be declared within a Sub or Function
procedure. Move that item outside of and prior to any procedure.
It would be helpful if you posted the code that is causing the
problem.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
F

Fraggs

Code
-------------------
Answer = MsgBox("Do you want to continue ?", _
vbOKCancel, "My Title")
If Answer = vbOK Then ActiveWorkbook.FollowHyperlink Address:= _
"Q:\AR, Retail Support & Cash Management\Retail Support\VOUCHERS\New Vouchers\Live\Voucher Issue Spreadsheets to date\Corporate Voucher Issues to date.xls" _
, NewWindow:=False, AddHistory:=True
Sheets("Nav").Select
Range("A1").Select
Else
If Answer = vbCancel Then Exit Su
 
D

Dave Peterson

It sounds like you have something outside your procedure.

This version (untested for the long path) seems to work ok:

Option Explicit
Sub testme()

Dim Answer As Long

Answer = MsgBox("Do you want to continue ?", _
vbOKCancel, "My Title")
If Answer = vbOK Then
ActiveWorkbook.FollowHyperlink Address:= _
"Q:\AR, Retail Support & Cash Management\Retail Support\" & _
"VOUCHERS\New Vouchers\Live\Voucher Issue Spreadsheets to date\" _
& "Corporate Voucher Issues to date.xls", _
NewWindow:=False, AddHistory:=True
Sheets("Nav").Select
Range("A1").Select
Else
Exit Sub
End If

End Sub

Check for extraneous characters after your End Sub or between any End Sub and
next Sub (if you have multiple procedures within the module).
 
Top