I have a macro that I wrote for a Travel Schedule at my job. This schedule is produced by someone else twice a month. I am currently emailing everyone the .bas file and asking them to import it into vba so that the macro will work with each iteration of the new travel schedule.
I am wondering how I can code the importing of a macro into an existing workbook to make this process easier for everyone. I can share my existing code if anyone needs it.
Thanks,
Hello laconicnexus,
Welcome to the forum!
Here is an example macro. You will need to change the FileSpec variable to match you file's directory and anme.
Sub ImportBAS() Dim FileSpec As String Dim VBbproj As Object FileSpec = "C:\Documents and Settings\Owner\My Documents\List_Unique_Tweet_Tags.Bas" Set VBproj = ThisWorkbook.VBProject VBproj.VBComponents.Import FileSpec End Sub
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
Alternative: send each user a file that contains the macro. Let that file save itself as an Addin.
Private Sub Workbook_Open() If ThisWorkbook.Name = "installatie.xls" Then Application.DisplayAlerts = False ThisWorkbook.SaveAs Application.StartupPath & "\example.xla", xlAddIn Application.DisplayAlerts = True ThisWorkbook.IsAddin = True ThisWorkbook.Save Workbooks.Add AddIns.Add ThisWorkbook.FullName AddIns("mvdp").Installed = True ThisWorkbook.Close False End If End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks