Javascript to VBA

Post new topic   Reply to topic

View previous topic View next topic Go down

Javascript to VBA

Post by stormchaser on Mon Oct 06, 2008 6:43 pm

Hi Akilesh

Good evening

I am a software developer in C# recently i have got an assignment to convert javascript functions to VBA. to be frank i dont know anything in VB 6.0. there are a bunch of javascript files is there anyway i can get help from you

http://darrenjohnstone.net/2008/07/22/examples-for-the-sharepoint-and-office-live-javascript-api/

you can download his javascript codes. there are about 22 js files in it. can you plz guide me how to convert this

Regards
Stormy


Last edited by stormchaser on Tue Oct 07, 2008 9:47 pm; edited 1 time in total

stormchaser

Posts: 5
Join date: 2008-10-06

View user profile

Back to top Go down

Re: Javascript to VBA

Post by thava on Mon Oct 06, 2008 7:08 pm

i think its not much difficult than to change to vb script ,you need make some changes only in the basic constructs like if, endif ; for next and so on other things are same if you find any thing difficult just post that portion only

thava

Posts: 3
Join date: 2008-10-04
Age: 27
Location: Madurai,Tamilnadu, india

View user profile

Back to top Go down

Re: Javascript to VBA

Post by Akhilesh B Chandran on Mon Oct 06, 2008 7:26 pm

Hai storm Smile,
Glad to see you here Smile and thanx for becoming a member of this form.
First of all I want to say that, I don't know javascript. If you tell me what each line do in javascript, then I can convert it into vb Smile

Here is a link for learning vbscript: VBScript Tutorial

What thava had said is almost right.... Smile When I checked that webpage, I found that most of the lines are easy to convert but except the variables decalred... I think its some built in functions of javascript. I will have a look at it and will soon reply Smile

-Gud nite Smile

Akhilesh B Chandran
Administrator
Administrator

Posts: 26
Join date: 2008-09-29
Age: 19
Location: Trivandrum, Kerala, India

View user profile http://askq.forumotion.net

Back to top Go down

Re: Javascript to VBA

Post by Akhilesh B Chandran on Mon Oct 06, 2008 7:33 pm

The actual javascript code of the first program:
Code:
  var lists = new SPAPI_Lists('http://localhost')
      var listDef = lists.getListAndView('Tasks', '{4011C1CE-A840-4BEB-89E3-A42DF3E3711E}');

      if (listDef.status == 200)
      {
        // The list definition is in listDef.resultNode and is a browser specific XML document
      }
      else
      {
        alert('There was an error: ' + listDef.statusText);
      }

A small conversion of the first program:

Code:
var lists = new SPAPI_Lists('http://localhost')
      var listDef = lists.getListAndView('Tasks', '{4011C1CE-A840-4BEB-89E3-A42DF3E3711E}');


dim lists
dim listDef
      if listDef.status = 200 then
      ' // The list definition is in listDef.resultNode and is a browser specific XML document
      else
        document.write("There was an error: " & listDef.statusText)
      end if

here the first two lines are not converted. I don't know what the function is doing in there. The other lines were converted. Similarly, you can convert the other codes also. If you have any doubts, please feel free to ask Smile

-Gud nite Smile

Akhilesh B Chandran
Administrator
Administrator

Posts: 26
Join date: 2008-09-29
Age: 19
Location: Trivandrum, Kerala, India

View user profile http://askq.forumotion.net

Back to top Go down

Re: Javascript to VBA

Post by stormchaser on Tue Oct 07, 2008 9:48 pm

Hi Akilesh & Thava

Good to see your reply Smile today i have converted all the 22 files, its easy to do in vbscript

Thanks 4 u r reply

Best Regards
Stormy

stormchaser

Posts: 5
Join date: 2008-10-06

View user profile

Back to top Go down

Re: Javascript to VBA

Post by Akhilesh B Chandran on Tue Oct 07, 2008 9:57 pm

U r welcome:)

Akhilesh B Chandran
Administrator
Administrator

Posts: 26
Join date: 2008-09-29
Age: 19
Location: Trivandrum, Kerala, India

View user profile http://askq.forumotion.net

Back to top Go down

View previous topic View next topic Back to top


Permissions of this forum:
You can reply to topics in this forum