View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default XP activesheet.paste error on VMware servers

Maybe it's the closing of the workbook that's losing the clipboard's content.
You could try delaying that close until later.

One way (untested):

Option Explicit
Sub testme()

Dim textWks As Worksheet
Dim ReportFiles As String
Dim RngToCopy As Range
Dim ToWks As Worksheet

ReportFiles = "c:\myfoldergoeshere\"

Set ToWks = Workbooks("gfst.xls").Worksheets("breakup by clienttype")

Workbooks.OpenText Filename:= ReportFiles & "GFST_Volumes_1.txt"

Set textWks = ActiveSheet
With textWks
Set RngToCopy = .Range("A3", .Range("a3").End(xlDown))
End With

With ToWks
RngToCopy.entirerow.Copy _
Destination:=.Range("a2")
.UsedRange.Columns.AutoFit
End With

Application.CutCopyMode = False
textWks.Parent.Close savechanges:=False

End Sub



pcora wrote:

Dave the whole code is

'
' Breakup by ClientType
'

Workbooks.OpenText Filename:= _
ReportFiles + "GFST_Volumes_1.txt"

' copy the txt file data
Rows("3:3").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
ActiveWorkbook.Close

'paste it in to the GFST's, Breakup by ClientType worksheet
Windows("GFST.XLS").Activate
Sheets("Breakup by ClientType").Select
Range("A2").Select
ActiveSheet.Paste
Cells.Select
Cells.EntireColumn.AutoFit

As I mentioned previously, the code runs perfectly on XP machines, with
both Excel XP and Excel 97. When put on a VMWare server it causes the
error.

There are 6 other sheets that uses the same code, that run previous to
the execution of this code for GFST. It's it GFST that crashes.

As you said, perhaps the clipboard contents are getting lost. Is there
any way I can force Excel to keep the clipboard contents?

--
pcora
------------------------------------------------------------------------
pcora's Profile: http://www.excelforum.com/member.php...o&userid=14787
View this thread: http://www.excelforum.com/showthread...hreadid=264109


--

Dave Peterson