msvisual.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Insert page break into Excel Ole object from vb6

 
Post new topic   Reply to topic    msvisual.com Forum Index -> OLE
Author Message
michaelgooding



Joined: 04 Oct 2007
Posts: 2

PostPosted: Mon Jan 31, 2005 4:51 pm    Post subject: Insert page break into Excel Ole object from vb6 Reply with quote

I've got an Excel spreadsheet created and opened as an OLE object; I
can load values to it, set the font, the margins, but I just can't find
a way to programmatically insert a pagebreak. I cut and paste from an
Excel macro:
and that didn't work; I'm hoping that there's some sort of

objSheet.HPageBreaks.Add Before:=ActiveCell

that doesn't result in an automation error. All help gratefully
received.

Mike Gooding
------------

Archived from group: microsoft>public>vb>ole
Back to top
View user's profile Send private message
Björn Holmgren



Joined: 04 Oct 2007
Posts: 261

PostPosted: Tue Feb 01, 2005 5:57 pm    Post subject: Re: Insert page break into Excel Ole object from vb6 Reply with quote

wrote in message@z14g2000cwz.googlegroups.com...
> I've got an Excel spreadsheet created and opened as an OLE object; I
> can load values to it, set the font, the margins, but I just can't find
> a way to programmatically insert a pagebreak. I cut and paste from an
> Excel macro:
> and that didn't work; I'm hoping that there's some sort of
>
> objSheet.HPageBreaks.Add Before:=ActiveCell
>
> that doesn't result in an automation error. All help gratefully
> received.
>
> Mike Gooding
> ------------
>

My guess is that fails because VB (unlike Excel) does not know what
"ActiveCell" is.
Try prefixing with the application object:

objSheet.HPageBreaks.Add Before:=objSheet.Application.ActiveCell

--
Björn Holmgren
Back to top
View user's profile Send private message
michaelgooding



Joined: 04 Oct 2007
Posts: 2

PostPosted: Tue Feb 01, 2005 2:18 pm    Post subject: Re: Insert page break into Excel Ole object from vb6 Reply with quote

Björn Holmgren wrote:
> wrote in message
> @z14g2000cwz.googlegroups.com...
> > I've got an Excel spreadsheet created and opened as an OLE object;
I
> > can load values to it, set the font, the margins, but I just can't
find
> > a way to programmatically insert a pagebreak. I cut and paste from
an
> > Excel macro:
> > and that didn't work; I'm hoping that there's some sort of
> >
> > objSheet.HPageBreaks.Add Before:=ActiveCell
> >
> > that doesn't result in an automation error. All help gratefully
> > received.
> >
> > Mike Gooding
> > ------------
> >
>
> My guess is that fails because VB (unlike Excel) does not know what
> "ActiveCell" is.
> Try prefixing with the application object:
>
> objSheet.HPageBreaks.Add Before:=objSheet.Application.ActiveCell
>

Brilliant! Thanks.

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
Insert Excel Data in Word document? Hi, I have a Word document with, among other texts, some tags. To each tag is associated a cell in an Excel sheet.(I might as well use the Excel cell naming convention as tags, ex : B3, H17, etc..) I would like to write a visual basic app to do the follow

Why can't create Excel.Application object using CreateObject Hi, there, I try to create an object using CreateObject function, I got "nothing" from the return variable without any error messages, but It works well on another computer, we have the same environment same references

Method of '~' of Object '~' Failed error for Excel WIth V Hi, I face a specific problem in running a macro from vb.The vb program does this:- open an excel sheet containing macros and the sheet on which i have the run the macro on.On running a macro on a specific sheet i get the error -2147417851 - Method of '

replace Excel 2000 -> Excel 2003 I am using the following code to edit data cell by cell: What:="", I get a Microsoft error "Microsoft Excel cannot find any data to replace. Check if your search formatting and criteria are defined correctly. I

Excel chart from VB to Excel Hi I've a Chart object in a VB6 form together with some text boxes, my question is can I "copy" the chart object from the form and place it in a Excel chart ?? I know I can create the chart in a Excel my question is can I
Post new topic   Reply to topic    msvisual.com Forum Index -> OLE All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group