Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
I am writing a macro for the first time and having trouble with it, Please advice
Macro |
---|
Sub Test set mytext = ActiveDocument.GetSheetObject("A").GetCell(0,0) ActiveDocument.Variables("vTest").SetContent mytext.text, true set myvar = ActiveDocument.GetSheetObject("B").GetCell(vTest,0) ActiveDocument.Variables("Test").SetContent mytext2.text, true End Sub |
I am trying to pull a value from sheet object A , store it in a variable vTest and then pass it as a parameter for pulling a value from Sheet object B. The macro above is what i have so far. Please advise,
Can i use a set x = vTest statement of some sort and create a temp variable and use that to get the value from Object B.
Also,
I know what i am trying to maybe easier with a peek function, but i want to be able to keep it dynamic as i have a huge access database linked to my application. Please advice,
Thank you for your time and effort,
Best,
Nik
No, it's not right. I'm thinking that you can add a line
on error resume next
In this case there will be no error message. But also there will be no a desired result, as if the macro didn't run.
A better way to handle it is to produce a message for user. But I'm not fluent enough in VBScript to tell how exactly to implement this. Maybe it makes sense for you to start a new discussion with this exact question.
Thanks, I Will have to think of a work around. Appreciate your time.
Best,
Nik