Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Pastespecial with Late Binding

I'm writing a Microsoft Access application that integrates with Excel, and
automatically makes Excel do various things using a late-bound Excel-type
object.

Like so:

Dim ExcelApp As Object
Set ExcelApp = CreateObject("Excel.Application")

Now, I'm trying to select a range of fields and paste only the values into
another worksheet. My code works fine when I'm not using late-binding, but
when I am it starts complaining:

"Pastespecial method of Range class failed."

I've tried several variations, neither work:

ExcelApp.Selection.Pastespecial Paste:=xlPasteValues

ExcelApp.ActiveSheet.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks :=False, Transpose:=False

Any ideas? Additionally, since it is quite possible that I will be doing a
lot more work in late-binding with Excel, is there any way I can troubleshoot
these kind of problems without bothering you guys?

Thanks!

Dustin
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Pastespecial with Late Binding

Hi Dustin

Stuff like xlPasteValues is most often enumerated numeric constants, which
are not recognized using late binding. The object browser in the application
(here Excel) is your friend then. Search for xlPasteValues and you will see

Const xlPasteValues = -4163 (&HFFFFEFBD)

now replace the constant xlPasteValues with the real value -4163 in your
code, and it should in theory work (it's past midnight here, so I didn't
test this). Likewise Const xlNone = -4142

HTH. Best wishes Harald

"Dustin Ventin" skrev i melding
...
I'm writing a Microsoft Access application that integrates with Excel, and
automatically makes Excel do various things using a late-bound Excel-type
object.

Like so:

Dim ExcelApp As Object
Set ExcelApp = CreateObject("Excel.Application")

Now, I'm trying to select a range of fields and paste only the values into
another worksheet. My code works fine when I'm not using late-binding, but
when I am it starts complaining:

"Pastespecial method of Range class failed."

I've tried several variations, neither work:

ExcelApp.Selection.Pastespecial Paste:=xlPasteValues

ExcelApp.ActiveSheet.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks :=False, Transpose:=False

Any ideas? Additionally, since it is quite possible that I will be doing

a
lot more work in late-binding with Excel, is there any way I can

troubleshoot
these kind of problems without bothering you guys?

Thanks!

Dustin



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Pastespecial with Late Binding

You can also get away without Pastespecial or any enumerated constants

With ExcelApp.Selection
.Value = .Value
End With

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Harald Staff" wrote in message
...
Hi Dustin

Stuff like xlPasteValues is most often enumerated numeric constants, which
are not recognized using late binding. The object browser in the

application
(here Excel) is your friend then. Search for xlPasteValues and you will

see

Const xlPasteValues = -4163 (&HFFFFEFBD)

now replace the constant xlPasteValues with the real value -4163 in your
code, and it should in theory work (it's past midnight here, so I didn't
test this). Likewise Const xlNone = -4142

HTH. Best wishes Harald

"Dustin Ventin" skrev i melding
...
I'm writing a Microsoft Access application that integrates with Excel,

and
automatically makes Excel do various things using a late-bound

Excel-type
object.

Like so:

Dim ExcelApp As Object
Set ExcelApp = CreateObject("Excel.Application")

Now, I'm trying to select a range of fields and paste only the values

into
another worksheet. My code works fine when I'm not using late-binding,

but
when I am it starts complaining:

"Pastespecial method of Range class failed."

I've tried several variations, neither work:

ExcelApp.Selection.Pastespecial Paste:=xlPasteValues

ExcelApp.ActiveSheet.PasteSpecial Paste:=xlPasteValues,

Operation:=xlNone,
SkipBlanks :=False, Transpose:=False

Any ideas? Additionally, since it is quite possible that I will be

doing
a
lot more work in late-binding with Excel, is there any way I can

troubleshoot
these kind of problems without bothering you guys?

Thanks!

Dustin





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Pastespecial with Late Binding

Well, I tried this:

ExcelApp.ActiveSheet.Pastespecial Paste:=-4163, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

And it didn't work. Did I do it wrong?

Dustin

"Harald Staff" wrote:

Hi Dustin

Stuff like xlPasteValues is most often enumerated numeric constants, which
are not recognized using late binding. The object browser in the application
(here Excel) is your friend then. Search for xlPasteValues and you will see

Const xlPasteValues = -4163 (&HFFFFEFBD)

now replace the constant xlPasteValues with the real value -4163 in your
code, and it should in theory work (it's past midnight here, so I didn't
test this). Likewise Const xlNone = -4142

HTH. Best wishes Harald

"Dustin Ventin" skrev i melding
...
I'm writing a Microsoft Access application that integrates with Excel, and
automatically makes Excel do various things using a late-bound Excel-type
object.

Like so:

Dim ExcelApp As Object
Set ExcelApp = CreateObject("Excel.Application")

Now, I'm trying to select a range of fields and paste only the values into
another worksheet. My code works fine when I'm not using late-binding, but
when I am it starts complaining:

"Pastespecial method of Range class failed."

I've tried several variations, neither work:

ExcelApp.Selection.Pastespecial Paste:=xlPasteValues

ExcelApp.ActiveSheet.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks :=False, Transpose:=False

Any ideas? Additionally, since it is quite possible that I will be doing

a
lot more work in late-binding with Excel, is there any way I can

troubleshoot
these kind of problems without bothering you guys?

Thanks!

Dustin




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Pastespecial with Late Binding

Actually, that pasted nothing. Isn't that code just setting a selection of
fields to equal what it is already?

Dustin

"Bob Phillips" wrote:

You can also get away without Pastespecial or any enumerated constants

With ExcelApp.Selection
.Value = .Value
End With

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Harald Staff" wrote in message
...
Hi Dustin

Stuff like xlPasteValues is most often enumerated numeric constants, which
are not recognized using late binding. The object browser in the

application
(here Excel) is your friend then. Search for xlPasteValues and you will

see

Const xlPasteValues = -4163 (&HFFFFEFBD)

now replace the constant xlPasteValues with the real value -4163 in your
code, and it should in theory work (it's past midnight here, so I didn't
test this). Likewise Const xlNone = -4142

HTH. Best wishes Harald

"Dustin Ventin" skrev i melding
...
I'm writing a Microsoft Access application that integrates with Excel,

and
automatically makes Excel do various things using a late-bound

Excel-type
object.

Like so:

Dim ExcelApp As Object
Set ExcelApp = CreateObject("Excel.Application")

Now, I'm trying to select a range of fields and paste only the values

into
another worksheet. My code works fine when I'm not using late-binding,

but
when I am it starts complaining:

"Pastespecial method of Range class failed."

I've tried several variations, neither work:

ExcelApp.Selection.Pastespecial Paste:=xlPasteValues

ExcelApp.ActiveSheet.PasteSpecial Paste:=xlPasteValues,

Operation:=xlNone,
SkipBlanks :=False, Transpose:=False

Any ideas? Additionally, since it is quite possible that I will be

doing
a
lot more work in late-binding with Excel, is there any way I can

troubleshoot
these kind of problems without bothering you guys?

Thanks!

Dustin








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Pastespecial with Late Binding

? xlnone
-4142

see last part of harald's post

--
Regards,
Tom Ogilvy

"Dustin Ventin" wrote in message
...
Well, I tried this:

ExcelApp.ActiveSheet.Pastespecial Paste:=-4163, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

And it didn't work. Did I do it wrong?

Dustin

"Harald Staff" wrote:

Hi Dustin

Stuff like xlPasteValues is most often enumerated numeric constants,
which
are not recognized using late binding. The object browser in the
application
(here Excel) is your friend then. Search for xlPasteValues and you will
see

Const xlPasteValues = -4163 (&HFFFFEFBD)

now replace the constant xlPasteValues with the real value -4163 in your
code, and it should in theory work (it's past midnight here, so I didn't
test this). Likewise Const xlNone = -4142

HTH. Best wishes Harald

"Dustin Ventin" skrev i melding
...
I'm writing a Microsoft Access application that integrates with Excel,
and
automatically makes Excel do various things using a late-bound
Excel-type
object.

Like so:

Dim ExcelApp As Object
Set ExcelApp = CreateObject("Excel.Application")

Now, I'm trying to select a range of fields and paste only the values
into
another worksheet. My code works fine when I'm not using late-binding,
but
when I am it starts complaining:

"Pastespecial method of Range class failed."

I've tried several variations, neither work:

ExcelApp.Selection.Pastespecial Paste:=xlPasteValues

ExcelApp.ActiveSheet.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone,
SkipBlanks :=False, Transpose:=False

Any ideas? Additionally, since it is quite possible that I will be
doing

a
lot more work in late-binding with Excel, is there any way I can

troubleshoot
these kind of problems without bothering you guys?

Thanks!

Dustin






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Pastespecial with Late Binding

OK:

ExcelApp.ActiveSheet.Pastespecial Paste:=-4163, Operation:=-4142, SkipBlanks _
:=False, Transpose:=False

This doesn't work, either.

"Application Defined or Object-Defined Error."

Any ideas?

Dustin

"Tom Ogilvy" wrote:

? xlnone
-4142

see last part of harald's post

--
Regards,
Tom Ogilvy

"Dustin Ventin" wrote in message
...
Well, I tried this:

ExcelApp.ActiveSheet.Pastespecial Paste:=-4163, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

And it didn't work. Did I do it wrong?

Dustin

"Harald Staff" wrote:

Hi Dustin

Stuff like xlPasteValues is most often enumerated numeric constants,
which
are not recognized using late binding. The object browser in the
application
(here Excel) is your friend then. Search for xlPasteValues and you will
see

Const xlPasteValues = -4163 (&HFFFFEFBD)

now replace the constant xlPasteValues with the real value -4163 in your
code, and it should in theory work (it's past midnight here, so I didn't
test this). Likewise Const xlNone = -4142

HTH. Best wishes Harald

"Dustin Ventin" skrev i melding
...
I'm writing a Microsoft Access application that integrates with Excel,
and
automatically makes Excel do various things using a late-bound
Excel-type
object.

Like so:

Dim ExcelApp As Object
Set ExcelApp = CreateObject("Excel.Application")

Now, I'm trying to select a range of fields and paste only the values
into
another worksheet. My code works fine when I'm not using late-binding,
but
when I am it starts complaining:

"Pastespecial method of Range class failed."

I've tried several variations, neither work:

ExcelApp.Selection.Pastespecial Paste:=xlPasteValues

ExcelApp.ActiveSheet.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone,
SkipBlanks :=False, Transpose:=False

Any ideas? Additionally, since it is quite possible that I will be
doing
a
lot more work in late-binding with Excel, is there any way I can
troubleshoot
these kind of problems without bothering you guys?

Thanks!

Dustin






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Late Binding Mark Excel Programming 4 October 17th 05 04:02 PM
Late Binding examples of binding excel application HeatherO Excel Programming 13 March 17th 05 08:19 AM
Late Binding help, Please Bud Dean Excel Programming 5 September 24th 04 04:31 AM
EARLY binding or LATE binding ? jason Excel Programming 6 February 26th 04 04:57 PM
DAO Late Binding? Sharqua Excel Programming 2 January 4th 04 02:05 AM


All times are GMT +1. The time now is 04:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"