LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VSTO removin formulas and email


I could really use some help here.
When the users clicks email (as attachment...) I need to create a cop
of the spread sheet that contains no formulas, only the data that is i
the cells. Delete hidden columns and rows, and then email the copy.

I know how to grab the email event, I can delete the hidden columns an
rows.

I do not know how to create a copy of a sheet that is only the data.

And right now, when I create a copy, the original has it's row
deleted, not the copy and the copy is emailed.
What I have:

Dim xRange As Excel.Range
Dim sname As String = "test"
Dim _cachePath As String = StingerGlobal.Config.InstallPath
Dim stuffToDelete As New ArrayList

Dim hiddenColumns As String = ""
Dim firstColumn As Boolean = True
Dim numColumns As Integer = _sheet.UsedRange.Columns.Count

'create temp copy

Dim tempSheet As Excel.Worksheet

tempSheet = DirectCast(_sheet, Excel.Worksheet)

tempSheet.Copy()
tempSheet.Name = sname
tempSheet.SaveAs(_cachePath & sname & ".xls")
'remove rows&columns
xRange = CType(tempSheet.Cells, Excel.Range)

For x As Integer = 1 To numColumns
Dim currentColumn As Excel.Range
Dim hiddenValue As Boolean
currentColumn = CType(tempSheet.Columns(x), Excel.Range)
hiddenValue = CType(currentColumn.Hidden, Boolean)
If hiddenValue = True Then
stuffToDelete.Add(currentColumn)
End If
Next

For Each col As Excel.Range In stuffToDelete
col.Delete()
Next


Thanks

--
geekoi
-----------------------------------------------------------------------
geekoid's Profile: http://www.msusenet.com/member.php?userid=80
View this thread: http://www.msusenet.com/t-187013486

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formulas assignment from array to range in VSTO Excel doesn't work vsto excel array to range Excel Worksheet Functions 0 December 11th 07 04:48 PM
formulas and email Syb Excel Discussion (Misc queries) 3 November 21st 07 10:06 PM
VSTO David12345 Excel Discussion (Misc queries) 2 December 27th 05 08:14 PM
VBA, UDFs and VSTO Terence Craig Excel Programming 3 October 25th 04 07:57 AM
VSTO 2.0 No Name Excel Programming 1 December 8th 03 09:02 PM


All times are GMT +1. The time now is 07:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"