workbook used to open but now crash with File/path error

P

pswanie

office excell 2003
windows xp

i been working on a .xls sheet with 3 userforms and about 8 usermodules.

to start i got

///////////////////////////////////////////////////////////////////////////////////////////////
Private Sub Workbook_Open()
Sheets("Sheet1").Select
Worksheets("sheet1").Range("K4").Value = False
Worksheets("sheet1").Range("K5").Value = False
Worksheets("sheet1").Range("K6").Value = False
Worksheets("sheet1").Range("K7").Value = False
Worksheets("sheet1").Range("K8").Value = False


With Application
.Calculation = xlCalculationAutomatic
.MaxChange = 0.001
End With

Application.Visible = False



UserForm1.Show

UserForm1.TextBox1.Value = ""
UserForm1.CheckBox1.Value = False
UserForm1.CheckBox2.Value = False
UserForm1.CheckBox3.Value = False
UserForm1.CheckBox4.Value = False
UserForm1.CheckBox5.Value = False


End Su
///////////////////////////////////////////////////////////////////////////////////////////////

when i select disable macro's the workbook dont crash but if i enable it
does....


///////////////////////////////////////////////////////////////////////////////////////////////
file/path access erro
///////////////////////////////////////////////////////////////////////////////////////////////

and when i go and look at the repair log i get

////////////////////////////////////////////////////////////////////////////////////////////////
Microsoft Office Excel File Repair Log

Errors were detected in file 'C:\files\Jobcard.xls'
The following is a list of repairs:

Lost Visual Basic project
///////////////////////////////////////////////////////////////////////////////////////////////
 
P

pswanie

i did allready

export all userform and modules

copy sheets to new workbook
copy paste workbook_open and workbook_close

save with diffrent name

import userforms and modules.

still crash
 
M

Mark Ivey

Is there another part of your macro(s) that refer to your file name or path
and file name specifically? Has any of that information changed?

The only thing I can see from what you have posted that may have a conflict
is your sheet reference.

Should " Worksheets("sheet1").Range("K4").Value = False " be "
Worksheets("Sheet1").Range("K4").Value = False " ?


Can you post any of your other code? Specifically the portion of it that
crashes.



Mark Ivey
 
P

pswanie

got it narrowed down to when ever i point/go to userform1

this is what i got in userfrom1


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''



Private Sub CommandButton4_Click()
Application.Visible = True

Unload UserForm1
Sheets("Sheet1").Select
ActiveWorkbook.Save
Application.Quit
End Sub


Private Sub CommandButton5_Click()
Unload UserForm1
UserForm1.Show
End Sub


Private Sub UserForm_activate()

'UserForm1.TextBox1.Value = ""
'UserForm1.CheckBox1.Value = False
'UserForm1.CheckBox2.Value = False
'UserForm1.CheckBox3.Value = False
'UserForm1.CheckBox4.Value = False
'UserForm1.CheckBox5.Value = False

End Sub

Private Sub UserForm_Initialize()

Me.TextBox1.Value = ""
Me.CheckBox1.Value = False
Me.CheckBox2.Value = False
Me.CheckBox3.Value = False
Me.CheckBox4.Value = False
Me.CheckBox5.Value = False
Call check4internet

End Sub

'prevent user clicking red "x"
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
End If
End Sub





Private Sub CommandButton1_Click()

If TextBox1 = "" Then
MsgBox "Please enter a description"
Else

Sheet1.Range("E1").Select
ActiveCell.FormulaR1C1 = "=username()"



If Worksheets("sheet1").Range("H30").Value = True Then


MsgBox "Ensure to select YES on the next security screen"
'Application.Visible = True


Call Mail_Selection_Range_Outlook_Body
Sheet1.Range("k4:k8").Select
Selection.Clear





Unload UserForm1
ActiveWorkbook.Save
Application.Quit


Else

MsgBox "Network cable unpluged/faulty" & vbNewLine & vbNewLine & _
"Use the page that print to fax to 000 000 0000"


Application.Sheets(Sheet1).PrintOut
Unload UserForm1
ActiveWorkbook.Save
Application.Quit


End If

End If


End Sub


Private Sub CommandButton3_Click()

UserForm1.Hide
UserForm2.Show

End Sub
 
M

Mark Ivey

pswanie,

Sorry... still not enough to go on. I loaded the code, but I cannot find a
reason for a crash with what you have posted. I had to disable the following
sub-routine calls due to the code not being posted just to run a user form.


Call check4internet

and this one

Call Mail_Selection_Range_Outlook_Body


I might be able to offer more help if you can email me this file.

My email is wmivey6311 at hotmail dot com.

Mark
 
A

Alan

office excell 2003
windows xp

i been working on a .xlssheet with 3 userforms and about 8 usermodules.

to start i got

///////////////////////////////////////////////////////////////////////////­////////////////////
Private Sub Workbook_Open()
Sheets("Sheet1").Select
    Worksheets("sheet1").Range("K4").Value = False
    Worksheets("sheet1").Range("K5").Value = False
    Worksheets("sheet1").Range("K6").Value = False
    Worksheets("sheet1").Range("K7").Value = False
    Worksheets("sheet1").Range("K8").Value = False

   With Application
        .Calculation = xlCalculationAutomatic
        .MaxChange = 0.001
    End With

    Application.Visible = False

UserForm1.Show

UserForm1.TextBox1.Value = ""
UserForm1.CheckBox1.Value = False
UserForm1.CheckBox2.Value = False
UserForm1.CheckBox3.Value = False
UserForm1.CheckBox4.Value = False
UserForm1.CheckBox5.Value = False

End Sub
///////////////////////////////////////////////////////////////////////////­////////////////////

when i select disable macro's the workbook dont crash but if i enable it
does....

///////////////////////////////////////////////////////////////////////////­////////////////////
file/path access error
///////////////////////////////////////////////////////////////////////////­////////////////////

and when i go and look at therepairlog i get

///////////////////////////////////////////////////////////////////////////­/////////////////////
Microsoft Office Excel FileRepairLog

Errors were detected in file 'C:\files\Jobcard.xls'
The following is a list of repairs:

Lost Visual Basic project.
///////////////////////////////////////////////////////////////////////////­////////////////////

Maybe you should try a popular Excel file recovery tool called
Advanced Excel Repair to repair your Excel file. It is a powerful tool
to repair corrupt or damaged Excel files.

Detailed information about Advanced Excel Repair can be found at
http://www.datanumen.com/aer/

And you can also download a free demo version at http://www.datanumen.com/aer/aer.exe

Hope this will help.

Alan
 

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