Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Object & Clipboard

Status
Not open for further replies.

dBjason

Programmer
Mar 25, 2005
355
US
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:

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
 

Nevermind... Found the code myself...

Here it is if anyone else needs it:

Code:
'Turn off warnings
Workbooks(Workbook1Name).Application.CutCopyMode = False
Workbooks(Workbook2Name).Application.CutCopyMode = False
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top