|

March 26th, 2009, 05:52 PM
|
|
Registered User
|
|
Join Date: Mar 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hyperlink
I have created below vba code to do exactly what i want but the questions are- I want a code that will save my work automatically in a folder and send this as hyperlink to email (Microsft outlook) using below written code
- Each time i run it, i want it to save as "Stress followed by the current date)
Sub GetRows() ' Copies all rows from sheet 'InputData' with a "Y" in the first column to sheet "Temp1"
Application.ScreenUpdating = False
Count = 1
Sheets("InputData").Select
' Copy Header Row
ABC = "A" & CStr(2) & ":" & "AD" & CStr(2)
ActiveSheet.Range(ABC).Select
Selection.Copy
Sheets("Temp1").Select
ABC = "A" & CStr(Count) & ":" & "AD" & CStr(Count)
Range(ABC).Select
ActiveSheet.Paste
Count = Count + 1
Sheets("InputData").Select
For i = 3 To 10000
If CStr(Cells(i, 1)) = "Y" Or CStr(Cells(i, 1)) = "y" Then
ABC = "A" & CStr(i) & ":" & "AD" & CStr(i)
Range(ABC).Select
Selection.Copy
Sheets("Temp1").Select
ABC = "A" & CStr(Count) & ":" & "AD" & CStr(Count)
Range(ABC).Select
ActiveSheet.Paste
Count = Count + 1
Sheets("InputData").Select
End If
Next i
Calculate
Call CreateEmailBody(Count - 1)
End Sub
Sub CreateEmailBody(NoRows)
Sheets("Temp1").Select
For i = 1 To NoRows
For j = 2 To 30
If i > 1 And j > 1 Then
LineStr = LineStr + " " + CStr(Cells(i, j))
Else
LineStr = LineStr + " " + Cells(i, j)
End If
Next j
'Sheets("Temp2").Select
'Cells(i, 1) = LineStr
'Sheets("Temp1").Select
'LineStr = ""
LineStr = LineStr + "&vbnextline"
Next i
Calculate
End Sub
|