how to change the visible range of embedded excel sheet?

B

BlueCoast

In my word doc, there is an embedded excel sheet.
When I insert it, it only include 4X2 cells;

but I want can control it's visible cells counts in my program.
for example: change to can display 8x2 cells;

how can i do it by using VBA or other language(C++,C#...)?

thanks a lot.
 
C

CyberTaz

Unfortunately an embedded Excel sheet created in Word is limited to 5
columns by 10 rows in the first place, but since yours is even smaller it
indicates that the object was actually created by copy/paste. That being the
case you cannot change the number of columns & rows displayed in it. You'll
have to delete the existing object, open the Excel file in Excel, copy the
range of data and replace the original object with a new one. Use Edit>
Paste Special to paste it as an Excel sheet.

You don't mention which version of Office you're using, but if it's 2008 you
can forget about any VBA - it's not supported in that version.
 
B

BlueCoast

My office version is Office2003. 2008 doesn't support VBA?! so,what's the
substitute? the book "Excel 2003 Power Programming with VBA" bought last year
havn't finished yet...

I have tryed in word application. Doubleclick the embedded excel window,
then you can drag the down-edge of the window, then the visible row can
change as big as possible, unless it can't be contained in single page.

so, it seemed that word (or excel) must support change visible range of
embedded excel sheet after created it. I just can not get the handle of that
activated window. I tried to use "Macro recording", but in "recording
state", the embedded object can not be activate...
 
C

CyberTaz

OLE is not implemented in Mac Office the same as it is in Windows. I don't
like it any more than anyone else, but that's the way it is:-( You can't
"get the handle" because there isn't one to get.

As for VBA in Mac Office 2008, there is no substitute. AppleScript can
handle some of the same operations for which VBA was previously used but
even if VBA was supported it wouldn't change the OLE limitations.

Regards |:>)
Bob Jones
[MVP] Office:Mac
 
B

BlueCoast

I do it in C++ environment.
step1>Search embedded excel window's info.
I use WinSight to find that embedded window. In my case:
window's class name = "EXCEL7", title = "Workbook at target.doc".

step2>Get target window's handle
Based Win32 API FindWindowEx(), I wrote a function to locate that window
(use recursion).

step3>Send message to embedded excel window
RECT r;
GetWindowRect(hWnd, &r);
SetWindowPos(hWnd, HWND_TOP,
r.left, r.top, r.right - r.left, r.bottom - r.top + 20,
SWP_FRAMECHANGED|SWP_NOMOVE|
SWP_NOZORDER|SWP_NOACTIVATE);

It Still doesn't work. please help me...
 
C

CyberTaz

OK, one more time:)

If you're working on a Windows system - Word 2003 - you're in the wrong
newsgroup... Even if you're running Windows in a emulator such as Parallels
or VMWare Fusion on Mac hardware. This one is for Word on the Macintosh (as
indicated by the .mac. In the address of the group) operating in MAC OS.
Look here for an appropriate Windows group:

http://www.microsoft.com/office/community/en-us/FlyoutOverview.mspx

If you *are* on a Mac you're wasting your time. There is no *handle* nor
does the Mac OS employ the Win32 API.

Regards |:>)
Bob Jones
[MVP] Office:Mac
 

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