Sub button_click() Dim DataSti As String Dim Filnavn As String Dim objFolders As Object Set objFolders = CreateObject(“WScript.Shell”).SpecialFolders Dim OutlookPrg As Object Dim OutlookMail As Object Set OutlookPrg = CreateObject(“Outlook.Application”) Set OutlookMail = OutlookPrg.CreateItem(0) DataPath = objFolders(“desktop”) & Application.PathSeparator Filnavn = Worksheets(“Sheet1”).Range(“D5”).Text & “.pdf” ActiveSheet.ExportAsFixedFormat _ Type:=xlTypePDF, _ Filename:=DataPath & Filnavn, _ Quality:=xlQualityStandard, Read More …
Author: Basse
a small homemade formula
This formula i use in my work quite a lot. Please note, that if you want to call the function in VBA, then you have to have the function in a module and not in a regular sheet. It took me a while to figure that one out 🙂 when i got started. I receive Read More …
“automatic” running subs
I sometimes get annoyed that i have to manually update Pivot tables and the likes, therefore i hope these can help other people as well. If there is any i have forgotten please comment, i’m still a bit new in the VBA world. Private sub Worksheet_Deactivate() ‘ what to do when you leave a Read More …
Force users to save spreadsheet with active macroes.
–> 2 steps, a friend of mine suggested that i put a save as button in the file, that activates the function button F12 (Save as) If you add the code below in VBA you’ll make sure the file is saved as a .xlsm Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim txtFileName As String Read More …