vba
84 TopicsUser Defined Function not showing with up "="
I have a few UDFs' that i have written for practice since i'm just getting into the programming portion of VBA. I have 3 Projects in my vba window. 1 for macros, 1 for my UDF, and the last one is whatever workbook i have opened. My question is how can i get my functions to show up when typing "=". I have searched google and the only answer that i came up with is i have to attach the module that has the function into the current workbook. My functions do work and show up when using "=" but it is a little annoying to have to attach them to every workbook i create since im dealing with new and multiple workbooks everyday. I also know that the "insert function" is under the formula tab and that works as well but still an annoyance. Just seems like there is an easier better way. Yes the functions are public, No the module names are not the same as the function name.78KViews0likes8CommentsRecovering a VBA protect password
I wrote a database in 2009/2010 in 2007. I migrated it to 2010, changed it to an accdb and password protected the VBA. In 2017, I left the company, handed over all of my passwords, and left my code in another's hands. In Sept 2021, they asked me to please come back, I did, and the password to the DB I am trying to recover was lost. I have tried using HxD, which doesn't work with accdb. How can I recover the password?9.5KViews1like5CommentsWhat does the "sourcedoc" part of a SharePoint filepath represent?
Hi all, I've been working on opening sharepoint files with VBA (reference PowerPoint decks via a ribbon button). I'm using "Application.ActivePresentation.FollowHyperlink SharePointPath" which is working fine. The constant SharePointPath is the direct SharePoint link for the files I want, which takes this form: https://tenant.sharepoint.com/:p:/r/sites/sitecollection/_layouts/15/Doc.aspx?sourcedoc=%7BB60C7EC5-A285-4BC7-9B0B-B98A148A26D7%7D&file=filename.pptx I've been testing different combinations of replacing the file in place, changing the filename, etc. to see how this can be broken and have noticed a strange behaviour. When I: - Uploaded a different file to the same folder - Deleted the original file - Renamed the new file to the filename of the old file I got a different "sourcedoc" (the bit in blue), however, the original link still worked. To play out the example: - I uploaded a file, which had this path https://tenant.sharepoint.com/:p:/r/sites/sitecollection/_layouts/15/Doc.aspx?sourcedoc=xxxxxx&file=originalfilename.pptx (this path was put in the constant "SharePointPath" in VBA) - I uploaded a new file, which had this path https://tenant.sharepoint.com/:p:/r/sites/sitecollection/_layouts/15/Doc.aspx?sourcedoc=yyyyyy&file=newfilename.pptx - I renamed the new file to the filename of the original file, which then had this path https://tenant.sharepoint.com/:p:/r/sites/sitecollection/_layouts/15/Doc.aspx?sourcedoc=yyyyyy&file=originalfilename.pptx - Then tried "Application.ActivePresentation.FollowHyperlink SharePointPath" WITHOUT updating SharePointPath (so the path was the xxxxxx path) and it still successfully opened the new file. So my question is, what is that "sourcedoc" reference? What does it represent and why didn't it matter that I changed it? I have seen it is a "document_GUID" but not clear on how it works why it didn't matter that it changed8.4KViews2likes2CommentsAssigning Macros in MS Teams Excel Workbooks to Buttons
Good Afternoon everyone, I have a workbook with a VBA Macro assigned to an Activex Control button. When opening the workbook I got an error message saying that form controls were not compatible outside of the MS Excel Desktop app. To get around this problem, I removed the Activex form control and inserted a shape in to the workbook which had the macro assigned. when the workbook is open in Desktop, clicking on the shape prompts the macro to run, however when the same workbook is open in teams, clicking the shape just selects it and doesnt prompt the macro to run. My question is: Are Macros completely incompatible with excel files hosted on MS Teams? And if they are, how do I add in a button or visual aid that once clicked, executes the macro? TIA Dan V7.8KViews0likes1CommentSharepoint list update is not working sometimes
Hello all, I have a sharepint list, and updating the list using access vba. I have a problem sometime the update works and sometimes it doesnot works, i have been trying to solve this problem using different commands like CurrentDb.TableDefs("shp_table").RefreshLink but unfortunately its not working. I am using a loop with maybe 5 recordsets, sometime 4 gets updated, sometimes 5 my update command is right. Do you have some possible solution for this? many thanks in Advance BR ArslanSolved7.7KViews0likes31Commentsvba sending email w/ attachment
long bit of code and im sure you all don't need all of it but its here for reference. The email portion works fine when under strBody i have text or a range with "". the problem im having is with getting it to upload a file path for an attachment. do i have to change all my code or is there just a slight typo. the WBname portion of it is a public variable defined in a different module and works like it should within its own module (the following module). Option Explicit Public Sub BlkLst_Save() Public WBname As String WBname = "BlackList" & ActiveSheet.Name & Format(Now(), "MMM dd, yyyy") Workbooks.Add ActiveWorkbook.SaveAs Filename:=WBname Workbooks("blacklist system").Activate Range("A1:F150").Select Selection.Copy Workbooks(WBname).Activate Range("A1").Select ActiveSheet.Paste End Sub so the above works fine. Below is the email portion of this and runs into an error when trying to pull from that save path as previously stated. I have bolded and italicized the portion that errors out. (**** indicate deleted information for security) Public Sub M_Emailer() 'sends email to Marik for blacklisted devices Dim CDO_Mail As Object Dim CDO_Config As Object Dim SMTP_Config As Variant Dim strSubject As String Dim strFrom As String Dim strTo As String Dim strCc As String Dim strBcc As String Dim strBody As String strSubject = "Blacklist From CDR" strFrom = "*******" strTo = "********" strCc = "" strBcc = "" strBody = C:\Users\tabor\Documents\&WBname&.xlsx Set CDO_Mail = CreateObject("CDO.Message") On Error GoTo Error_Handling Set CDO_Config = CreateObject("CDO.Configuration") CDO_Config.Load -1 Set SMTP_Config = CDO_Config.Fields With SMTP_Config .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com" .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "*******" .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "*******" .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465 .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1 .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 .Update End With With CDO_Mail Set .Configuration = CDO_Config End With CDO_Mail.Subject = strSubject CDO_Mail.From = strFrom CDO_Mail.To = strTo CDO_Mail.TextBody = strBody CDO_Mail.CC = strCc CDO_Mail.BCC = strBcc CDO_Mail.Send Error_Handling: If Err.Description <> "" Then MsgBox Err.Description End SubSolved7.5KViews0likes7CommentsNeeds Help on the VBA for an Attendance Sheet
Hi! I need to create a new routine so that it will highlight in the "Summary" sheet in i) red for courses that the staff has not attended after the deadline has passed, and ii) yellow for courses that the staff has attended but only after the deadline has passed. This has to be based on the "Attendance List" sheet Attached is the excel file. Any help is much appreciated!! Btw, I know how to do it using conditional formatting but I need to create a VBA for other purposes as well. https://docs.google.com/spreadsheets/d/1R-BrDQG_cJ0I0BzL_oIPVk8IGFFUbn77AoGFFmV1mBs/edit?usp=sharing6.9KViews0likes10Comments