ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   XP activesheet.paste error on VMware servers (https://www.excelbanter.com/excel-programming/311807-xp-activesheet-paste-error-vmware-servers.html)

pcora[_2_]

XP activesheet.paste error on VMware servers
 

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, wit
both Excel XP and Excel 97. When put on a VMWare server it causes th
error.

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

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

--
pcor
-----------------------------------------------------------------------
pcora's Profile: http://www.excelforum.com/member.php...fo&userid=1478
View this thread: http://www.excelforum.com/showthread.php?threadid=26410


Dave Peterson[_3_]

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



All times are GMT +1. The time now is 10:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com