I've got a spreadsheet that I'm manipulating
with VB-6. I've can't seem to get PasteSpecial
to work.
I recorded a macro in the spreadsheet.
Here is the VBA code.
Range("C5").Select
Selection.Copy
Range("C6").Select
Selection.PasteSpecial _
Paste:=xlPasteFormulas, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
Here is what I came up with in VB6 ...
Dim MyXL As Excel.Workbook
Dim MyXLSh As Excel.Worksheet
Set MyXL = GetObject(" -- file name -- ")
Set MyXLSh = MyXL.Worksheets(1)
' so far, so good.. I've done the above many times
' now, here's the problem area
With MyXLSh
.Range("C5").Select
.Copy <------------------------- weird background colors happen here
.Range("C6").Select <----------- crashes here
.PasteSpecial xlPasteFormulas <- never got this far !!
End With
I did ".Copy" and not ".Selection.Copy" because
the latter was not available from the tool-tips
(and thus, not recognized by VB6).
I left out "Paste:=xlPasteFormulas, (etc)" as I
got a compiler error (operation not recognized).
Any ideas?