Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel saves to a temp file then deletes original

Status
Not open for further replies.

artsi03

Instructor
Jan 19, 2005
20
0
0
FI
Hi,

I'm having a real problem running Excel. I have done a macro sheet to help input info. When I want to save the sheet, Excel asks if I want to save to a temp file. If I choose no, nothing will be saved. If I choose yes, Excel will write a file containing hex numbers as it's name, without extension and it deletes the original file.

This problems makes gives a real headache. If anyone here knows how to fix this, please help me.

Thank you.
Artsi
 
There is a distinct lack of info in your post. And you'd be better off posting in the VBA Visual Basic for Applications (Microsoft) forum, than here.

You say in your post:
When I want to save the sheet, Excel asks if I want to save to a temp file.

... well, a view of the actual code would help here, I mean, what VBA command do you think is trying to execute at this point? Excel asks if you want to save to a temp file when it's about to crash in some way ... in other words this is about trying to solve errors that crash Excel, and not some design query regarding your VBA macro.

Cheers, Glenn.

Did you hear about the literalist show-jumper? He broke his nose jumping against the clock.
 
Hi,

Here's my full VBA sheets. The file is used in a network, and it seems to work perfectly with 4/5 computers. They all have same Excel version, so I was thinking the problem might be elsewhere than in code. But then again, I might be wrong. Hope this will help solving the matter.

Thanks.

-----------------------------------------------------

Dim Scheduled_Time As Date

Private Sub Workbook_Open()
Schedule_Inactivity_Close
Schedule_Alusta
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Application.OnTime Scheduled_Time, "Inactivity_Close", , False
Schedule_Inactivity_Close
End Sub

Private Sub Schedule_Inactivity_Close()
Scheduled_Time = Now() + TimeValue("00:15")
Application.OnTime Scheduled_Time, "Inactivity_Close"
End Sub

-----------------------------------------------------

Private Sub Schedule_Alusta()
ActiveSheet.Protect Password:=4444, UserInterfaceOnly:=True
Selection.AutoFilter Field:=1
Selection.AutoFilter Field:=2
Selection.AutoFilter Field:=3
Selection.AutoFilter Field:=4
Selection.AutoFilter Field:=5
Selection.AutoFilter Field:=6
Selection.AutoFilter Field:=7
Selection.AutoFilter Field:=8
Selection.AutoFilter Field:=9
Selection.AutoFilter Field:=10
Selection.AutoFilter Field:=11
Selection.AutoFilter Field:=12
Selection.AutoFilter Field:=13
Range("F4").Select
ActiveCell.FormulaR1C1 = "14"
Range("E4").Select
Selection.ClearContents
Range("D4").Select
Selection.ClearContents
Range("C4").Select
ActiveCell.FormulaR1C1 = "=R[-3]C[-1]"
Range("B4").Select
Selection.ClearContents
Range("A4").Select
ActiveCell.FormulaR1C1 = "=R[5]C[2]+R[7]C[2]"
Range("B4").Select
End Sub


---------------------Modules----------------

Sub alusta()
'
' Makro1 Makro
'

'
ActiveSheet.Protect Password:=4444, UserInterfaceOnly:=True
Selection.AutoFilter Field:=1
Selection.AutoFilter Field:=2
Selection.AutoFilter Field:=3
Selection.AutoFilter Field:=4
Selection.AutoFilter Field:=5
Selection.AutoFilter Field:=6
Selection.AutoFilter Field:=7
Selection.AutoFilter Field:=8
Selection.AutoFilter Field:=9
Selection.AutoFilter Field:=10
Selection.AutoFilter Field:=11
Selection.AutoFilter Field:=12
Selection.AutoFilter Field:=13
Range("F4").Select
ActiveCell.FormulaR1C1 = "14"
Range("E4").Select
Selection.ClearContents
Range("D4").Select
Selection.ClearContents
Range("C4").Select
ActiveCell.FormulaR1C1 = "=R[-3]C[-1]"
Range("B4").Select
Selection.ClearContents
Range("A4").Select
ActiveCell.FormulaR1C1 = "=R[5]C[2]+R[7]C[2]"
Range("B4").Select
ActiveSheet.Protect Password:=4444, DrawingObjects:=True, Contents:=True, Scenarios:=True
' ActiveWorkbook.save

End Sub

-----------------------------------------------------

Sub varaa()
'
' varaa Makro
'

'
ActiveSheet.Protect Password:=4444, UserInterfaceOnly:=True
If Range("D4") > 0 Then
Range("G9").Select
Selection.Copy
Range("G11").Offset(Range("C9").Value).Select
Selection.PasteSpecial Paste:=xlFormulas, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("H9").Select
Application.CutCopyMode = False
Selection.Copy
Range("H11").Offset(Range("C9").Value).Select
Selection.PasteSpecial Paste:=xlFormulas, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("L9").Select
Application.CutCopyMode = False
Selection.Copy
Range("L11").Offset(Range("C9").Value).Select
Selection.PasteSpecial Paste:=xlFormulas, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("C4").Select
Application.CutCopyMode = False
Selection.Copy
Range("E11").Offset(Range("C9").Value).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("D4").Select
Application.CutCopyMode = False
Selection.Copy
Range("D11").Offset(Range("C9").Value).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("F4").Select
Application.CutCopyMode = False
Selection.Copy
Range("F11").Offset(Range("C9").Value).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("E4").Select
Application.CutCopyMode = False
Selection.Copy
Range("I11").Offset(Range("C9").Value).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("B4").Select
Application.CutCopyMode = False
Selection.Copy
Range("B11").Offset(Range("C9").Value).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("A4").Select
Selection.Copy
Range("C11").Offset(Range("C9").Value).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("M7").Select
ActiveCell.FormulaR1C1 = "A Esansaari 2005"
Range("B4").Select
' ActiveWorkbook.save
Else
MsgBox "Ole hyvä, täytä laskun tiedot keltaiselle pohjalle sivuun ennen varauksen tekemistä."
End If
End Sub

-----------------------------------------------------

Sub Inactivity_Close()
ActiveSheet.Protect Password:=4444, UserInterfaceOnly:=True
ActiveWorkbook.save
ThisWorkbook.Close True
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top