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

Hi,
I'm having a problem with a couple of lines of my code which I need to
change. I'm no programmer, so I don't really understand all this early/
late binding stuff..

I do know that I need to use late binding though, as I have a file
which is used by users with different Office versions..

My code is coming up with an error on lines;

wdApp.Selection.EndKey Unit:=wdStory
&
wdApp.Selection.PageSetup.TopMargin = CentimetersToPoints(4.8)

How can I fix this?

Cheers
Tony

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Late Binding Help please

On 3 Aug, 10:43, bony_tony wrote:
Hi,
I'm having a problem with a couple of lines of my code which I need to
change. I'm no programmer, so I don't really understand all this early/
late binding stuff..

I do know that I need to use late binding though, as I have a file
which is used by users with different Office versions..

My code is coming up with an error on lines;

wdApp.Selection.EndKey Unit:=wdStory
&
wdApp.Selection.PageSetup.TopMargin = CentimetersToPoints(4.8)

How can I fix this?

Cheers
Tony


A number of problems - firstly, WdStory is a Word constant, not a
global one - it's value is 6. Secondly, the := method doesn't work
outside of the host application - so the first version should be

wdApp.Selection.EndKey 6

The second one uses a Word command in the form of CentimetersToPoints
so should be expressed as...


WdApp.Selection.PageSetup.TopMargin = appwd.CentimetersToPoints(4.8)

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default Late Binding Help please

Thanks for that.
For the line;
wdApp.Selection.PageSetup.TopMargin = appwd.CentimetersToPoints(4.8)
It is saying an Object is required. How do I get round this? Dim
whatever as Object??? I'm guessing...

I'm also having problems with the lines;
wdApp.Selection.MoveUp Unit:=wdLine, Count:=2, Extend:=wdExtend
wdApp.Selection.HomeKey Unit:=wdLine, Extend:=wdExtend

And the following line is saying the number needs to be between -32765
& 32767;
wdApp.Application.PrintOut Filename:="", Range:=wdPrintAllDocument,
Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=True,
PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0,
PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0

Thanks
Tony


On 3 Aug, 11:08, "
wrote:
On 3 Aug, 10:43, bony_tony wrote:





Hi,
I'm having a problem with a couple of lines of my code which I need to
change. I'm no programmer, so I don't really understand all this early/
late binding stuff..


I do know that I need to use late binding though, as I have a file
which is used by users with different Office versions..


My code is coming up with an error on lines;


wdApp.Selection.EndKey Unit:=wdStory
&
wdApp.Selection.PageSetup.TopMargin = CentimetersToPoints(4.8)


How can I fix this?


Cheers
Tony


A number of problems - firstly, WdStory is a Word constant, not a
global one - it's value is 6. Secondly, the := method doesn't work
outside of the host application - so the first version should be

wdApp.Selection.EndKey 6

The second one uses a Word command in the form of CentimetersToPoints
so should be expressed as...

WdApp.Selection.PageSetup.TopMargin = appwd.CentimetersToPoints(4.8)- Hide quoted text -

- Show quoted text -



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Late Binding Help please

On 3 Aug, 11:26, bony_tony wrote:
Thanks for that.
For the line;
wdApp.Selection.PageSetup.TopMargin = appwd.CentimetersToPoints(4.8)
It is saying an Object is required. How do I get round this? Dim
whatever as Object??? I'm guessing...

I'm also having problems with the lines;
wdApp.Selection.MoveUp Unit:=wdLine, Count:=2, Extend:=wdExtend
wdApp.Selection.HomeKey Unit:=wdLine, Extend:=wdExtend

And the following line is saying the number needs to be between -32765
& 32767;
wdApp.Application.PrintOut Filename:="", Range:=wdPrintAllDocument,
Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=True,
PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0,
PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0

Thanks
Tony

On 3 Aug, 11:08, "



wrote:
On 3 Aug, 10:43, bony_tony wrote:


Hi,
I'm having a problem with a couple of lines of my code which I need to
change. I'm no programmer, so I don't really understand all this early/
late binding stuff..


I do know that I need to use late binding though, as I have a file
which is used by users with different Office versions..


My code is coming up with an error on lines;


wdApp.Selection.EndKey Unit:=wdStory
&
wdApp.Selection.PageSetup.TopMargin = CentimetersToPoints(4.8)


How can I fix this?


Cheers
Tony


A number of problems - firstly, WdStory is a Word constant, not a
global one - it's value is 6. Secondly, the := method doesn't work
outside of the host application - so the first version should be


wdApp.Selection.EndKey 6


The second one uses a Word command in the form of CentimetersToPoints
so should be expressed as...


WdApp.Selection.PageSetup.TopMargin = appwd.CentimetersToPoints(4.8)- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


Sorry, I'm half asleep I think - replace AppWd with WdApp (I used my
standard word object name instead of your variable)


For Range:=wdPrintAllDocument refer to my comments about := and about
Word Constants - to find out the value of any Word constant, go to
Word's VBA and create a sub routine along these lines

sub tester
msgbox wdPrintAllDocument

end sub

Running this will give you the numeric equivalent of the constatn

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default Late Binding Help please

Ok thanks, think I get it now.

Your Sub is coming up with a 0 in Word..

Sub tester()
MsgBox wdPrintAllDocument
End Sub



On 3 Aug, 11:31, "
wrote:
On 3 Aug, 11:26, bony_tony wrote:





Thanks for that.
For the line;
wdApp.Selection.PageSetup.TopMargin = appwd.CentimetersToPoints(4.8)
It is saying an Object is required. How do I get round this? Dim
whatever as Object??? I'm guessing...


I'm also having problems with the lines;
wdApp.Selection.MoveUp Unit:=wdLine, Count:=2, Extend:=wdExtend
wdApp.Selection.HomeKey Unit:=wdLine, Extend:=wdExtend


And the following line is saying the number needs to be between -32765
& 32767;
wdApp.Application.PrintOut Filename:="", Range:=wdPrintAllDocument,
Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=True,
PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0,
PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0


Thanks
Tony


On 3 Aug, 11:08, "


wrote:
On 3 Aug, 10:43, bony_tony wrote:


Hi,
I'm having a problem with a couple of lines of my code which I need to
change. I'm no programmer, so I don't really understand all this early/
late binding stuff..


I do know that I need to use late binding though, as I have a file
which is used by users with different Office versions..


My code is coming up with an error on lines;


wdApp.Selection.EndKey Unit:=wdStory
&
wdApp.Selection.PageSetup.TopMargin = CentimetersToPoints(4.8)


How can I fix this?


Cheers
Tony


A number of problems - firstly, WdStory is a Word constant, not a
global one - it's value is 6. Secondly, the := method doesn't work
outside of the host application - so the first version should be


wdApp.Selection.EndKey 6


The second one uses a Word command in the form of CentimetersToPoints
so should be expressed as...


WdApp.Selection.PageSetup.TopMargin = appwd.CentimetersToPoints(4.8)- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


Sorry, I'm half asleep I think - replace AppWd with WdApp (I used my
standard word object name instead of your variable)

For Range:=wdPrintAllDocument refer to my comments about := and about
Word Constants - to find out the value of any Word constant, go to
Word's VBA and create a sub routine along these lines

sub tester
msgbox wdPrintAllDocument

end sub

Running this will give you the numeric equivalent of the constatn- Hide quoted text -

- Show quoted text -





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Late Binding Help please

On 3 Aug, 11:40, bony_tony wrote:
Ok thanks, think I get it now.

Your Sub is coming up with a 0 in Word..

Sub tester()
MsgBox wdPrintAllDocument
End Sub

On 3 Aug, 11:31, "



wrote:
On 3 Aug, 11:26, bony_tony wrote:


Thanks for that.
For the line;
wdApp.Selection.PageSetup.TopMargin = appwd.CentimetersToPoints(4.8)
It is saying an Object is required. How do I get round this? Dim
whatever as Object??? I'm guessing...


I'm also having problems with the lines;
wdApp.Selection.MoveUp Unit:=wdLine, Count:=2, Extend:=wdExtend
wdApp.Selection.HomeKey Unit:=wdLine, Extend:=wdExtend


And the following line is saying the number needs to be between -32765
& 32767;
wdApp.Application.PrintOut Filename:="", Range:=wdPrintAllDocument,
Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=True,
PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0,
PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0


Thanks
Tony


On 3 Aug, 11:08, "


wrote:
On 3 Aug, 10:43, bony_tony wrote:


Hi,
I'm having a problem with a couple of lines of my code which I need to
change. I'm no programmer, so I don't really understand all this early/
late binding stuff..


I do know that I need to use late binding though, as I have a file
which is used by users with different Office versions..


My code is coming up with an error on lines;


wdApp.Selection.EndKey Unit:=wdStory
&
wdApp.Selection.PageSetup.TopMargin = CentimetersToPoints(4.8)


How can I fix this?


Cheers
Tony


A number of problems - firstly, WdStory is a Word constant, not a
global one - it's value is 6. Secondly, the := method doesn't work
outside of the host application - so the first version should be


wdApp.Selection.EndKey 6


The second one uses a Word command in the form of CentimetersToPoints
so should be expressed as...


WdApp.Selection.PageSetup.TopMargin = appwd.CentimetersToPoints(4.8)- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


Sorry, I'm half asleep I think - replace AppWd with WdApp (I used my
standard word object name instead of your variable)


For Range:=wdPrintAllDocument refer to my comments about := and about
Word Constants - to find out the value of any Word constant, go to
Word's VBA and create a sub routine along these lines


sub tester
msgbox wdPrintAllDocument


end sub


Running this will give you the numeric equivalent of the constatn- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


.... and therefore use 0 instead of WdprintAllDocument in your code.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default Late Binding Help please

Ah, sorry. Duh
Didn't realise I was using "wdPrintAllDocument"
Ok, so the Word sub will give me the constant values I need to use.
Thanks for your help
Tony


On 3 Aug, 11:48, "
wrote:
On 3 Aug, 11:40, bony_tony wrote:





Ok thanks, think I get it now.


Your Sub is coming up with a 0 in Word..


Sub tester()
MsgBox wdPrintAllDocument
End Sub


On 3 Aug, 11:31, "


wrote:
On 3 Aug, 11:26, bony_tony wrote:


Thanks for that.
For the line;
wdApp.Selection.PageSetup.TopMargin = appwd.CentimetersToPoints(4.8)
It is saying an Object is required. How do I get round this? Dim
whatever as Object??? I'm guessing...


I'm also having problems with the lines;
wdApp.Selection.MoveUp Unit:=wdLine, Count:=2, Extend:=wdExtend
wdApp.Selection.HomeKey Unit:=wdLine, Extend:=wdExtend


And the following line is saying the number needs to be between -32765
& 32767;
wdApp.Application.PrintOut Filename:="", Range:=wdPrintAllDocument,
Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=True,
PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0,
PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0


Thanks
Tony


On 3 Aug, 11:08, "


wrote:
On 3 Aug, 10:43, bony_tony wrote:


Hi,
I'm having a problem with a couple of lines of my code which I need to
change. I'm no programmer, so I don't really understand all this early/
late binding stuff..


I do know that I need to use late binding though, as I have a file
which is used by users with different Office versions..


My code is coming up with an error on lines;


wdApp.Selection.EndKey Unit:=wdStory
&
wdApp.Selection.PageSetup.TopMargin = CentimetersToPoints(4.8)


How can I fix this?


Cheers
Tony


A number of problems - firstly, WdStory is a Word constant, not a
global one - it's value is 6. Secondly, the := method doesn't work
outside of the host application - so the first version should be


wdApp.Selection.EndKey 6


The second one uses a Word command in the form of CentimetersToPoints
so should be expressed as...


WdApp.Selection.PageSetup.TopMargin = appwd.CentimetersToPoints(4.8)- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


Sorry, I'm half asleep I think - replace AppWd with WdApp (I used my
standard word object name instead of your variable)


For Range:=wdPrintAllDocument refer to my comments about := and about
Word Constants - to find out the value of any Word constant, go to
Word's VBA and create a sub routine along these lines


sub tester
msgbox wdPrintAllDocument


end sub


Running this will give you the numeric equivalent of the constatn- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


... and therefore use 0 instead of WdprintAllDocument in your code.- Hide quoted text -

- Show quoted text -



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
Using ADO and Late Binding Jan T. Excel Programming 4 July 2nd 07 12:47 PM
Late Binding to a dll XLW Excel Programming 0 August 28th 06 06:43 PM
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
EARLY binding or LATE binding ? jason Excel Programming 6 February 26th 04 04:57 PM


All times are GMT +1. The time now is 08:26 PM.

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"