Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default macro compile error

Create the software on a machine on which you can set the reference to
Outlook 9 not Outlook 11.

Alternatively, on your machine, remove the reference to Outlook and
make your program work. Now, it should work on older machines -- as
long as you are not using constructs introduced in a later version of
the software.


--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Password Protect Macro - Compile Error Teddy-B Excel Discussion (Misc queries) 1 January 23rd 08 02:50 AM
Using "Countif" in macro gives compile error ashish128 Excel Discussion (Misc queries) 4 June 15th 07 12:23 PM
help with this error-Compile error: cant find project or library JackR Excel Discussion (Misc queries) 2 June 10th 06 09:09 PM
Macro / Compile Error / Duplicate Declaration carl Excel Worksheet Functions 1 June 29th 05 08:55 PM


All times are GMT +1. The time now is 10:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"