Hi,
Due to a change in security policy, we have had to change our hardware, operating system (now its WIN7) and MS office suite (rolled back to office 2007). and of course its at about 48hours notice.
So the excel script that as previously used under Office 2010 and XP and was working fine, now does not work coming up with the following error.
'Runtime error '1004'
Application-defined or object defined error.
The error seems to be with this line, but I cannot see why! Unless this is not supported in Excel 2007.
Can anybody throw some light on this at all?
from this I am deducing that it does not like the
This is the code I am using
'If at first you don't succeed, then your hammer is below specifications'
Due to a change in security policy, we have had to change our hardware, operating system (now its WIN7) and MS office suite (rolled back to office 2007). and of course its at about 48hours notice.
So the excel script that as previously used under Office 2010 and XP and was working fine, now does not work coming up with the following error.
'Runtime error '1004'
Application-defined or object defined error.
The error seems to be with this line, but I cannot see why! Unless this is not supported in Excel 2007.
Can anybody throw some light on this at all?
Code:
ActiveSheet.SaveAs Filename:=DTAddress & "-" & sRange1 & "-" & sRange2 & "-" & sRange3, FileFormat:=xlNormal
from this I am deducing that it does not like the
Code:
DTAddress = CreateObject("WScript.shell").specialfolders("Desktop") & Application.PathSeparator
This is the code I am using
Code:
Private Sub Save_Click()
Dim sRange1 As String
Dim sRange2 As String
Dim sRange3 As String
Dim DTAddress As String
'Change Record:
'1 - Changed drive letter to B:\ due to new policy change on hardware & software versions FEB2014.
ActiveSheet.PrintOut
sRange1 = ActiveSheet.Range("I9")
sRange2 = ActiveSheet.Range("I5")
sRange3 = Format$(Date, "DD-MM-YYYY")
Application.DisplayAlerts = False
ActiveSheet.Shapes("Save").Delete
DTAddress = CreateObject("WScript.shell").specialfolders("Desktop") & Application.PathSeparator
ActiveSheet.SaveAs Filename:=DTAddress & "-" & sRange1 & "-" & sRange2 & "-" & sRange3, FileFormat:=xlNormal
ActiveWorkbook.SaveCopyAs Filename:="B:\" & "-" & sRange1 & "-" & sRange2 & "-" & sRange3 '1
ThisWorkbook.Saved = True
ThisWorkbook.Close
Application.DisplayAlerts = True
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal target As Excel.Range, Cancel As Boolean)
If Not Intersect(target, Range("B19:I19")) Is Nothing Then
If target.Interior.ColorIndex = xlNone Then
target.Interior.ColorIndex = 3
ElseIf target.Interior.ColorIndex = 3 Then
target.Interior.ColorIndex = xlNone
End If
End If
If Not Intersect(target, Range("B47:L47")) Is Nothing Then
If target.Interior.ColorIndex = xlNone Then
target.Interior.ColorIndex = 3
ElseIf target.Interior.ColorIndex = 3 Then
target.Interior.ColorIndex = xlNone
End If
End If
If Not Intersect(target, Range("B49:I49")) Is Nothing Then
If target.Interior.ColorIndex = xlNone Then
target.Interior.ColorIndex = 3
ElseIf target.Interior.ColorIndex = 3 Then
target.Interior.ColorIndex = xlNone
End If
End If
End Sub
Private Sub worksheet_change(ByVal target As Range)
If target.Address = "$I$9" Then
ActiveSheet.Name = Range("I9")
End If
End Sub
'If at first you don't succeed, then your hammer is below specifications'