Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro compile error
When I send my exelfile to other user the macro doesn't work. When excuted it
displays "compile error". I have made my macro in version 11 (2003) but I have several users of the file and they can have version 9 or 10. The users of my file are not able to set the macro references manually. Can anyone help me with a macro which find and select the users version as reference? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro compile error
Try this:
Sub tester() Dim lngVersion As Long lngVersion = Application.Version End Sub -- That'll put the version number into lngVersion. You can then use that as a variable in your code. www.alignment-systems.com "Jan Holmstrom" wrote: When I send my exelfile to other user the macro doesn't work. When excuted it displays "compile error". I have made my macro in version 11 (2003) but I have several users of the file and they can have version 9 or 10. The users of my file are not able to set the macro references manually. Can anyone help me with a macro which find and select the users version as reference? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro compile error
Hi John,
Thanks for reply. I've tried to put your code in to my macro. But it can still not identify the outlook version. I am testing the macro with no reference to outlook at all, as my users may never had set any references at all in the VBA editor. This is my code: ActiveWorkbook.Save Dim IngVersion As Long IngVersion = Application.Version Dim olApp As Object Set olApp = CreateObject("Outlook.Application") Dim olApp As Outlook.Application Dim olMail As MailItem Dim CurrFile As String Set olApp = New Outlook.Application Set olMail = olApp.CreateItem(olMailItem) ActiveWorkbook.Save CurrFile = ActiveWorkbook.Path & "\" & ActiveWorkbook.Name With olMail .To = " .CC = "" .BCC = "" .Subject = "ENERGIRAPPORTERING" .Body = "HERMED FREMSENDES ENERGIRAPPORT FOR UNDERTEGNEDE" .Attachments.Add ActiveWorkbook.FullName .Send End With Set olMail = Nothing Set olApp = Nothing ActiveWorkbook.PrintOut Application.DisplayAlerts = False Application.Quit "John.Greenan" skrev: Try this: Sub tester() Dim lngVersion As Long lngVersion = Application.Version End Sub -- That'll put the version number into lngVersion. You can then use that as a variable in your code. www.alignment-systems.com "Jan Holmstrom" wrote: When I send my exelfile to other user the macro doesn't work. When excuted it displays "compile error". I have made my macro in version 11 (2003) but I have several users of the file and they can have version 9 or 10. The users of my file are not able to set the macro references manually. Can anyone help me with a macro which find and select the users version as reference? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Password Protect Macro - Compile Error | Excel Discussion (Misc queries) | |||
Using "Countif" in macro gives compile error | Excel Discussion (Misc queries) | |||
help with this error-Compile error: cant find project or library | Excel Discussion (Misc queries) | |||
Macro / Compile Error / Duplicate Declaration | Excel Worksheet Functions |