Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA

Status
Not open for further replies.

kitnba

MIS
Jul 31, 2000
132
HK
worksheet(1).VPageBreaks(1).Location = worksheet.Range(&quot;G1&quot;)<br><br>how do i change to VFP format, it say unkown name when I run it.<br><br>I want to move the Vertical Pagebreak to a <br>Colmun 'G'.<br><br>
 
Kitnba, I don't see a reference to the Excel object in your statement:<br><br>worksheet(1).VPageBreaks(1).Location = worksheet.Range(&quot;G1&quot;)<br><br>Normally, you'd use CreateObject() to instantiate Excel, then use that reference from then on.&nbsp;&nbsp;For example:<br><br><FONT FACE=monospace>oExcel = CreateObject(&quot;Excel.Sheet&quot;)<br>...<br>oExcel.Worksheets(1).VPageBreaks(1).Location = Worksheets(1).Range(&quot;e5&quot;)<br></font><br><br>You'll need to use the oExcel reference as I've shown above.&nbsp;&nbsp;Also, note that my example differs from yours slightly - mine is right out of the Excel VB Reference, and specifically references Worksheets(1) before the Range property.&nbsp;&nbsp;I really don't know much about Excel automation, but maybe that is one the issues you are experiencing.<br><br> <p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br>
 
Ooops!&nbsp;&nbsp;I just broke the rule I was trying to emphasize.<br><br>Change the line I wrote:<br><br><FONT FACE=monospace>oExcel.Worksheets(1).VPageBreaks(1).Location = Worksheets(1).Range(&quot;e5&quot;)</font><br><br>to:<br><br><FONT FACE=monospace>oExcel.Worksheets(1).VPageBreaks(1).Location = <font color=red>oExcel.</font>Worksheets(1).Range(&quot;e5&quot;)</font> <p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top