outlook - How determine in which language an email is written using VBA

In My project, I would like to automate The following task in my work place :Mails Triagingthis task consist to read the email , detect the language of the email and send the email in particular folder in Outlook.lets say the Inbox have two emails one English and another in French .the program should send the email for example to Jack EN for English emails and Julie FR For french emails.So far I have this what I have :Sub TriageEmails() Dim myolApp As Outlook.Application Dim aItem As Object Set myolApp = CreateObject ("Outlook.Appli...Read more

vba - ListRows.Add doesn't appear to work

I've got a really odd case… hopefully someone is able to help me out, I've search many forums looking for a solution, the closest I could find related to it (kinda) is here, though I've tried all the suggestions to no avail…I'm trying to run a function to return a data list in a string delimitated by a semicolon from an oracle stored function. (This value function call seems to work fine).I then loop through the string for each data value and print it to a blank table (0 rows) declared in my subroutine. which I use to load into an access data b...Read more

vba - Looping Through All Cells in a Column and checking if each cell contains a string within string

I run an excel report weekly and need to replace all of the values in a certain column depending on which strings are existent within the different values. I have already learned a lot about how to loop through the column from stack overflow , as well as about the instr function but my macro still is not working. Also, many of the solutions that I have found require a actual string to search, but since this changes every time, I need to search through a range. Hoping that someone can help me figure out why...thank you in advance!Sub FlagReplace...Read more

Dealing with Empty Cells in VBA for Access

I have the following code which is supposed to step through an array of fields and create two new arrays to add to a new recordset:For Each Field In SDSRecordsets(i) Debug.Print (j) Debug.Print (Field.Value) fieldNames(j) = Field.Name If Field.Value = Null Then values(j) = "" Else values(j) = Field.Value End If j = j + 1NextThe first time this loop runs, the Debug.Print lines print out 0 and then the string value in the first cell as it should. It then runs through the rest of it with no problems. The second t...Read more

vba - File name presists in Dir() function over multiple sessions

I have some code in a Excel VBA macro and it seems like its persisting values between sessions. The issue is with the BtnUpdate_Click event, the message box doesnt trigger even if the file path in NewDataFilePath is invalid. Public NewDataFilePath As StringPrivate Sub BtnFileBrowse_Click() Dim fdlg As FileDialog Set fdlg = Application.FileDialog(msoFileDialogOpen) fdlg.Title = "Select New Dataset" fdlg.Filters.Clear fdlg.Filters.Add "Excel Files Only", "*.xls; *.xlsx" fdlg.Show If fdlg.SelectedItems.Count <> 0 Then ...Read more

vba - checking a value in column F and checking in Column G for a value existing

I am in the process of automating a day to day process. I have ID's in column F and ID2's in column G. How could I write a VBA for filling in the blanks if the IDs in column F are the same? IE ID 123 will always have the ID of 1. In some cases the ID to be used is not the one from above.Test data:ID ID2123 1123 *Blank*456 56456 *Blank*456 *Blank*789 23I have utilized some existing stackoverflow code and tried to adapt it for my needs.Code: Sub FindingtheBID() Dim sht As Worksheet, lastrow As Long, i As Lo...Read more

vba - Insert a Row after every instance of specific text

I'm looking to insert a new blank row after every instance of HDR in the sheet. I cannot figure out how to make the code move beyond the first instance to continue through the rest of the sheet. Sub NewRowInsert() Dim SearchText As String Dim GCell As Range SearchText = "HDR" Set GCell = Cells.Find(SearchText).Offset(1) GCell.EntireRow.Insert End Sub...Read more

listbox - VBA Ecel UserForm multiple selection, dymanic item list

I did userForm with this instruction: tried to do dynamic item list based on table, With ListBox_1.RowSource = Worksheets("warianty").ListObjects("in_").ListColumns(1).DataBodyRange.ColumnHeads = True.ColumnCount = 3End Withit comes out blank with no list to Select from.I used object table to get dynamic range. Of course I can use other solution, but this one seemed achievable.Then I want to copy each selected items to other table starting with first row.Here is code i t...Read more

vba - Filtering tables using worksheet variables

I'm trying to filter a table and then copy a value, different filter, different value. Rinse and repeat.I've recorded a macro to help me along and that looks like:ActiveSheet.ListObjects("Tabel1").Range.AutoFilter Field:=10, Criteria1:= _ "Lopend"When I replace activesheet with my declared ws variable (it works, I see the value in the locale) I get error 9, subscript out of range.wsReo.ListObjects("Tabel1").Range.AutoFilter Field:=10, Criteria1:="Lopend"Any ideas as to why?...Read more

vba - Force validation/update event without leaving ComboBox control

On Forms where I have multiple input fields Tab/Enter goes to the next field and that triggers the validation/update process nicely.However on one of my multipages I have 1 single ComboBox I have set it to accept only elements from the list.The thing is that the user will only get an error popup for wrong values when trying to move to another page, because hitting Enter/Tab does not trigger validation if there are no other controls to jump on.What command can I put in a _KeyPress or _KeyDown event that will trigger the validation/update of the ...Read more

rename - VBA Folder Renaming

I am looking to use VBA to rename a set of folders. The purpose is to remove special characters from the folder names such as - : ; /, etc. Here is what I have so far:Sub File_renaming2()Dim objFSO As FileSystemObject, myObj As Object, mySource As Object, Folder As VariantSet mySource = myObj.GetFolder("C:\Users\John.Doe\Desktop\ABC\VBA Test folder")For Each Folder In mySource.Folder Folder.Name.Replace What:="-", Replacement:=" " 'replace - with space Folder.Name.Replace What:=":", Replacement:=" " 'replace : with space Folder.Name.Re...Read more

vba - Are Access 2010 databases not accessible with Excel if password protected using default encryption (High Security)?

I am currently supporting an Excel 2010 spreadsheet and Access 2010 database that were written by business users. One of the requirements of the Access database is that it be encrypted. It was encrypted with the default encryption settings "Use default encryption(Higher security)" which can be set in Options -> Client Settings.Now that the database is password protected and encrypted, I am unable to connect to the database through Excel. My testing revolves around importing data into Excel, but what I really need to do is create a row in a log ...Read more

vba - From Access 2002 to Access 2010 Conversion failed when converting date and/or time from character string

I am working on this Access 2002 database. It uses linked servers to SQL Server 2008. I am having a problem where in load of the main form it does a DLookup and looks at a date. EndDate = Nz(DLookup("End_Date", "Employee", "EmpID= " & EmpID & " AND End_Date IS NOT NULL AND End_Date < #" & Now & "#"), "")Now this works fine in Access 2002, but in Access 2010 I get the:Conversion failed when converting date and/or time from character stringHere's the kicker though, it works in Access 2010 for one user: myself. No other user...Read more

vba - Saving Access file to SharePoint with code

I have a standard Access Database saved on SharePoint. My organization uses SharePoint, but I only have standard access to areas particular to my department. (I cannot create or link a web based database to SharePoint with my access level.)In my Access file, I have a form that saves its data to the table - locally - when I hit the submit button.The ribbon below appears and if clicked, transfers the whole Access file to the SharePoint storage location, but only if that button is clicked. Otherwise it only saves a local copy.Is there a way I can ...Read more