![]() |
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 |
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 |
All times are GMT +1. The time now is 05:10 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com