Excel VBA 2003
Hello,
I'm trying to do a sort of automated transpose with Excel. I have a subroutine from Access which tags the Excel object, copies data from SQL Server onto a workbook, copies that range to a new workbook transposing the information similar to a pivot. Works pretty good. The reason it's copied twice in Excel is because I can't find a way to transpose the data when grabbing it from SQL Server (code listed below).
The problem I'm having is after it's all said and done, I get this irritating message -- "There is a large amount of information on the Clipboard. Do you want to be able to past this information into another program later?".
Hell no!
Is there any way to suppress that message so my users won't see it? Here's the code:
Any help is greatly appreciated.
Thanks,
Jason
Hello,
I'm trying to do a sort of automated transpose with Excel. I have a subroutine from Access which tags the Excel object, copies data from SQL Server onto a workbook, copies that range to a new workbook transposing the information similar to a pivot. Works pretty good. The reason it's copied twice in Excel is because I can't find a way to transpose the data when grabbing it from SQL Server (code listed below).
The problem I'm having is after it's all said and done, I get this irritating message -- "There is a large amount of information on the Clipboard. Do you want to be able to past this information into another program later?".
Hell no!
Is there any way to suppress that message so my users won't see it? Here's the code:
Code:
'Build & Export Yardi Excel Spreadsheets
Set ExApp = New Excel.Application
Workbooks.Add
With ActiveSheet.QueryTables.Add(Connection:="OLEDB;Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Data Source=SDSQL2;Use Procedure for Prepare=1;Initial Catalog=TimberlineWarehouse", Destination:=Range("A1"), SQL:="SELECT * FROM UnconsolidatedIncome_Yardi")
.Refresh
End With
Range("A1:AL200").Select
Selection.Copy
Workbook1Name = ActiveWorkbook.Name
Workbooks.Add
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Workbook2Name = ActiveWorkbook.Name
Workbooks(Workbook1Name).Close False
Workbooks(Workbook2Name).SaveAs SaveLocation
ActiveWorkbook.Close
ExApp.Quit
Set ExApp = Nothing
Any help is greatly appreciated.
Thanks,
Jason