Problems with copyPicture

J

JMGonzalez

Hi!
I'm doing a project to automate excel and word files generation from Visual
studio in C++. The problem occurs when triying to copy a range of cells from
excel as a picture to be copied in a word file.
CopyPicture needs 2 parameters: appearance and format. I'd like to use
apperance as "xlscreen" and format as "xlbitmap" since it looks like the
other possibilities truncate the number of columns in the range if it is
quite width.
In c++ CopyPicture requires 2 long parameters and I passed appearance = 2
and format = 2.
When running it, an error in CopyPicture method occurs and i guess it is due
to the second parameter because i've tried with other parameters and it works
well. Does anyone know the correct equivalent in "long" to "xlbitmap"? Or
another way to take a range of cells in excel and paste as a picture?
Thanks in advance!
 
S

Steve Rindsberg

Does anyone know the correct equivalent in "long" to "xlbitmap"?

Start Excel.
Press Alt+F11 to get into the VB ide
Press Ctrl+G to make the Immediate window visible
In the immediate window, type:

? xlbitmap

Press enter. There's your answer. ;-)

You can also use the Object Browser (press F2)
 
J

JMGonzalez

Thanks for your help but it was the same value i have already used so that is
not the problem. When i use copypicture with xlbitmap parameter an error
ocurrs but it works well when using xlpicture. Does anyone know how to solve
it? Thanks
 
S

Steve Rindsberg

No other ideas, I'm afraid. Unless ...

To VB/VBA and the Excel object model, a Long is a signed 32-bit integer.
Is there any chance it means something subtly different in C++?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top