Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Excel 2007 upload with macros

Author  Topic 

vrdj@chevron.com
Starting Member

1 Post

Posted - 2009-01-12 : 11:19:53
hi all....can you help me in this...
1) is it possible to upload and download the excel 2007 file with macros in sql 2005?
i think if we upload/download the datas alone the macros cant included in that(please correct me if i am wrong)
2) is it possbile to save the entire file physically in sql 2005?

Thank you in adv.

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2009-01-13 : 05:24:05
SQL Server 2008 can hold unstructured data such as an Excel File.

In SQL Server 2005 the options I can think of:
1. Divide data and Macros into seperate operations.
Save blank Excel files with macros to be used as templates (path could be stored in table).
If data needs exported from Sql Server to Excel:
First copy blank template to new location and copy data into it.
2.Use Excel API to directly access macro.
The following is some VBA to copy a macro from one workbook to another.
from: http://www.mrexcel.com/forum/showthread.php?t=84621
You would need to modify it if running externally using API.

Sub CopyOneModule()

Dim FName As String
With Workbooks("Book2")
FName = .Path & "\code.txt"
.VBProject.VBComponents("Module1").Export FName
End With
Workbooks("book1").VBProject.VBComponents.Import FName

End Sub
Go to Top of Page
   

- Advertisement -