R is a programming language and environment used primarily for statistical data analysis.

Share tech news, updates, or what's on your mind.

Sign up to Post

Good Afternoon.

our IT team has changed the Office programs from 32bit of Excel to 64bit, now our finance department has a lot of files with macros in them, like around 598 of those files have codes that use the window API by using the Declare statement.
i would need to convert a bunch of 32bit API calls in these files to 64bit compliant calls while preserving 32bit compatibility as well.

i created the attached template. where i can put the directory, then file names and then two box for searching code and replacing it with code.

so, ideally , the code to loop through all files in the referred directory and its subfolders and if the files listed in Column C found then initiate search on those files by finding the codes listed in column D and replace them with code in column E.

i search the whole day and i could not find anything or any help on google or in any other forum, which brings me here to EE VBA gurus and i am hoping someone would be able to help me here.

thank you in advance.
Hello Experts,
Need this.
Data(changed data)
Keycol data
1      O1
1      O2
1      O3
2      O4
3      O5
3      O5
7      O2
7      O1
Output I need below

Keycol data       LineNo
1      O1,O2,O3    1
2      O4          2
3      O5          3
7      O1,O2       4
possible in sql query? I need to generate  sequential number for a new column.
DO i need a loop or cursor forthis?
Thank you
Thanks in advance to all. ( I am a novice VBA user)

I trying to right a script that will import appointments in into Outlook 2016 from excel 2016. I have add some lines to the follow, but still no Joy.

What I would like to do is use the headings ,  to import, update the group calendar.

Subject      Categories            Location                        Start Date      Start Time      End Date      End Time      Description      Required Attendees      Show Time As      Reminder Set      Remind Beforehand      

Sub RegisterAppointmentList()
    ‘ adds a list of appontments to the Calendar in Outlook
    Dim olApp As Outlook.Application
    Dim olAppItem As Outlook.AppointmentItem
    Dim r As Long
    On Error Resume Next

    Set olApp = GetObject("", "Outlook.Application")
    On Error GoTo 0
    If olApp Is Nothing Then
        On Error Resume Next
        Set olApp = CreateObject("Outlook.Application")
        On Error GoTo 0
        If olApp Is Nothing Then
            MsgBox "Outlook is not available!"
            Exit Sub
        End If
    End If
    r = 6 ‘ first row with appointment data in the active worksheet
    Dim mysub, myStart, myEnd
    While Len(Cells(r, 2).Text) <> 0
        mysub = Cells(r, 2) & ", " & Cells(r, 3)
        myStart = DateValue(Cells(r, 5).Value) + Cells(r, 6).Value
        myEnd = DateValue(Cells(r, 5).Value) + Cells(r, 7).Value
        ‘DeleteTestAppointments mysub, myStart, myEnd
        Set olAppItem = …

I want to NOT pass objects or references in the constructor.  I think the instantiated object should know who instantiated it, and it should be able to scope the instantiator's  objects.  
Object A instantiates Object B.  Can Object B access Object A's  properties, members, etc?

Below is actual sample showing real example.  Advice please?

Kind Regards

Line 13, I want to NOT pass these objects in the constructor.   Delete lines 13 - 17.
using System;
using System.Web;
using System.Web.SessionState;
using System.Web.UI.WebControls;

namespace prjLogDebug.Utilities
    public class Log
        HiddenField _hdnLogDebugChild;
        string _SessionItem;

        public Log(HiddenField hdnLogDebugChild, HttpSessionState Session)
            _hdnLogDebugChild = hdnLogDebugChild;
            _SessionItem = Session["skPost"].ToString();

        public void Append(string message)
            string UrlAbsolute = HttpContext.Current.Request.Url.AbsolutePath;
            DateTimeOffset dt = DateTimeOffset.Now;

            _hdnLogDebugChild.Value = dt.ToString("HH:mm:ss")
            + "-->" + _SessionItem.ToString()
            + ">" + UrlAbsolute
            + "-->" + message
            + "\r\n"
            + _hdnLogDebugChild.Value;

Open in new window

One of many webforms:
using prjLogDebug.Utilities;
using System;

namespace prjLogDebug.Site
    public partial class wfChild_1 : System.Web.UI.Page
        Log Log;
        protected void Page_Load(object sender, EventArgs e)
            if (Session["skPost"] != null)
                Session["skPost"] = (int)Session["skPost"] + 1;
                //Throw err

            hdnLogDebugChild.Value = ""; //clear persisted data from prior post
            Log = new Log(hdnLogDebugChild, Session);

            Log.Append("Child_1 PageLoad()");

        protected void btnLog_Click(object sender, EventArgs e)
            string s = "Text to add from wfChild_1";


            string result = hdnLogDebugChild.Value; // to view with debugger

Open in new window


Although I have many skills outlined on my resume, I want to add another practical skill, in case my current skills become obsolete.

So, I have been toying with the idea of teaching myself Swift or some other iOS programming language in order to be able to create apps for the iPhone.

Out of the many new business skills a professional could learn, would this be the best?  

If so, how long does it take to learn and is it extraordinarily difficult?  Are there are good and free tutorials online that will successfully teach the lay person such a programming language?


Hi there,

It's been a while since I've seen this type of equation, not sure what to do here:
I am not sure this even makes sense, because if i = 1 then why not just say X subscript 1, instead of X subscript i? Also, "n-1" implies that we're considering a sample set of "n" numbers, which implies that the value of "i" changes "n" amount of times.

I don't know for sure though.

Hope you will help.
Need email sent automatically when date is entered in any independent cell in column E3:E45.

Option Explicit

Sub email()

 Dim r As Range
    Dim cell As Range

    Set r = Range("E3:E45")

    For Each cell In r

        If cell.Value = Date Then

            Dim Email_Subject, Email_Send_From, Email_Send_To, _
            Email_Cc, Email_Bcc, Email_Body As String
            Dim Mail_Object, Mail_Single As Variant

            Email_Subject = "Trucks Due for B Service"
            Email_Send_From = ".com"
            Email_Send_To = ".com"
            Email_Cc = ""
            Email_Bcc = ""
            Email_Body = "body"

            On Error GoTo debugs
            Set Mail_Object = CreateObject("Outlook.Application")
            Set Mail_Single = Mail_Object.CreateItem(0)
            With Mail_Single
            .Subject = Email_Subject
            .To = Email_Send_To
            .cc = Email_Cc
            .BCC = Email_Bcc
            .Body = Email_Body
            End With

        End If


    Exit Sub

        If Err.Description <> "" Then MsgBox Err.Description
End Sub

Open in new window

(Edit: Added CODE tags)
I am trying to execute external script in SQL server 2016. For that the following script executed

sp_configure 'external scripts enabled', 1;

Then I restarted the service.

However, after executing following script run_value is still 0

code trying to run is..

EXEC sp_execute_external_script
      @language = N'R'
     ,@script = N'      res <-quantile(InputDataSet$Ages);
     ,@input_data_1 = N'SELECT Ages = DATEDIFF(YEAR,[BirthDate],GETDATE())
                        FROM [AdventureWorksDW2016CTP3].[dbo].[DimCustomer];'

Please help!
I have a situation where the data in my database is to be analysed and results are to be published on the web page, i built a web-form through which required data can be selected by the user, now this data should be send to R for some  analysis and results are needed to be published back on the  webpage,i have no idea how this can be done, i built the web app in PHP, with MySQL as database, any help will be appreciated,thanks in advance.
I had this question after viewing Index Match Vlook up for a master file.

I have added some code to inform the user if the part does not exist on the master
For Each cell In rng
    If Application.CountIf(sws.Rows(4), cell.Value) > 0 Then
        col = Application.Match(cell.Value, sws.Rows(4), 0)
        r = Application.Match(cell.Offset(0, 2).Value, sws.Columns(col), 0)
        If col > 0 Then
            If Err.number = 13 Then
                cell.Offset(0, 3).Value = "Part not in master"
                 cell.Offset(0, 3).Value = sws.Cells(r, myCodeCol)
            End If
        End If
    End If
Next cell

i have been thinking about the first column and the issue getting all the invoices eventually to one sheet. The problem is that none of them put a column showing it is from them. I don't want the user to type in the company name becuase that would just open the door to problems So how about this.  when the user open the invoice spreadsheet, they will run a vba script , and it will ask who the company is:
ZED .. Maple.  etc.  the available companies  would be based upon ROW 4 in the master sheet in (sheet2). They choose the company and it is copied down in col A to the end of the data . I have run a few manual samples and it works good.  So my question is , how do i get that list to show up in VBA ?