Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Variable problem

I am using automation to work with word and i would like to use the code I
have to add bookmarks with a constant for the name then the page number
following that.

The code works for positioning perfectly when tested with an insertafter and
add an "X" but gives me an error in my bookmark names.

The code is like this -

r.Bookmarks.Add "MeterNo & Selection.Information(wdActiveEndPageNumber)),
vbInformation"

I can use the same line of code in a messagebox and it works.

This is the line used in the messagebox in word.

MsgBox ("page no -" & Selection.Information(wdActiveEndPageNumber)),
vbInformation

I have tried to replace it like this

r.Bookmarks.Add "MeterNo & mypage"

and add the line

mypage = Selection.Information(wdActiveEndPageNumber)

and declare it as dim as variant and dim as string but neither approach
works.

can someone give me hand here

Thanks

Rob



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default Variable problem

You might want to try posting in the word.vba NG.

Rob Hargreaves wrote:
I am using automation to work with word and i would like to use the code I
have to add bookmarks with a constant for the name then the page number
following that.

The code works for positioning perfectly when tested with an insertafter and
add an "X" but gives me an error in my bookmark names.

The code is like this -

r.Bookmarks.Add "MeterNo & Selection.Information(wdActiveEndPageNumber)),
vbInformation"

I can use the same line of code in a messagebox and it works.

This is the line used in the messagebox in word.

MsgBox ("page no -" & Selection.Information(wdActiveEndPageNumber)),
vbInformation

I have tried to replace it like this

r.Bookmarks.Add "MeterNo & mypage"

and add the line

mypage = Selection.Information(wdActiveEndPageNumber)

and declare it as dim as variant and dim as string but neither approach
works.

can someone give me hand here

Thanks

Rob



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
Having a problem using a variable to add a 'name' Kobayashi[_50_] Excel Programming 1 October 29th 04 03:20 PM
Having a problem using a variable to add a 'name' Kobayashi[_49_] Excel Programming 1 October 29th 04 02:22 PM
Having a problem using a variable in Kobayashi[_48_] Excel Programming 1 October 29th 04 01:24 PM
vba variable problem joao Excel Programming 3 December 15th 03 04:31 PM
Problem trying to us a range variable as an array variable TBA[_2_] Excel Programming 4 September 27th 03 02:56 PM


All times are GMT +1. The time now is 05:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"