|
-
Jan 8th, 2006, 03:19 AM
#1
Thread Starter
New Member
Problem with excel
I have this spreadsheet that was set up by someone who has now left my job and just wondering if some one here could help
most likely something simple but this is way over my head any head appreciated
VB Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim i, j As Integer
Dim texte As String
Dim Wksht As Worksheet
On Error Resume Next 'Fermeture de Data Passdown
Workbooks(Range("NameDataPassdown").Value).Close SaveChanges:=False
On Error GoTo 0
If Userallowed = False Then Exit Sub
Application.ScreenUpdating = False
If Range("Freeaccess").Value = True Then
Or ActiveWorkbook.ReadOnly Then Exit Sub
SortieSansEnregistrement = True
Sheets("LOG").Select
On Error Resume Next
ActiveSheet.ShowAllData
Range("RefID").End(xlDown).Select
On Error GoTo 0
Call Enregistrement 'Affichage feuille warning + enregistrement
If MsgBox("Passdown is already saved." & Chr(10) & _
"Do you want to create a new copy in the Free To Use Folder ?" & Chr(10) & Chr(10) & _
"A copy must be created at the end of each shift.", vbYesNo) = vbNo Then Exit Sub
'Je cache les feuilles non free to use + administrator pour access a tous
Call AffichFeuillesUtilisateurs
'J'autorise l'acces de tous au fichier dans Folder "Free to use" avant de sauvegarder
Range("Freeaccess").Value = 1
'Sauvegarde d'une copie actualisee dans Folder "Free to use"
ActiveWorkbook.SaveAs Filename:= _
Range("filename").Value & " Passdown by " & Range("Currentuser").Value & " " & Format(Now, "dd-mm-yy hh-mm-ss") & ".xls"
some is in french but the line
Or ActiveWorkbook.ReadOnly Then Exit Sub
comes up in red when attempting to debug
regards
micks
-
Jan 8th, 2006, 03:22 AM
#2
Fanatic Member
Re: Problem with excel
Red as in a breakpoint? Or Red as an error occurs on that line? If Error whats the error your getting?
-
Jan 8th, 2006, 04:01 AM
#3
Thread Starter
New Member
Re: Problem with excel
thanks for reply
previously when we'd close this spreadsheet we'd a questions asking do we want to save in another location for access as its locked when editing
now when we close we get a
"compile error:syntax error"
then visual basic editor opens and the first line "Private Sub Workbook_BeforeClose(Cancel As Boolean)" is highlighted in yellow and the line
"Or ActiveWorkbook.ReadOnly Then Exit Sub" is highlighted as if cursor is dragged across it and then when clicked on its the only line in red.i assumed a problem but maybe a breakpoint i dont know anything about this .
regards
-
Jan 8th, 2006, 04:03 AM
#4
Re: Problem with excel
It would be red as in an error.
As there is no matching "End If" for the previous line, I would guess that they are supposed to be combined, eg:
VB Code:
If Range("Freeaccess").Value = True _
Or ActiveWorkbook.ReadOnly Then Exit Sub
Oh, and welcome to VBForums micks!
-
Jan 8th, 2006, 04:57 AM
#5
Thread Starter
New Member
Re: Problem with excel
now when i put in your line i get"compile error:expected then or goto"
cheers
Thanks a mill
worked a treat i didnt leave a space before the _ so got an error
once again fair play
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|