Running macros it returns compile error in hidden module

A

aivars.avotins

Hi,
I have several macros in personal.xls, what is shared with other people
on network drive. Till some time all worked well without problems, bet
then started problems for some computers (some working perfectly,
computers running Office XP and Office 2003, but problem is on both
verions ). Problem is when running macros it returns that "compile
error in hidden module".

Problem is only in macros what works with links:
1) breaks workbooks links to other workbooks
2) opens new outlook mail message and copy link to excel workbook
(workbook is saved on server)

Other macros is working ok (saving all as values)

Could some one help? Should I reinstall Office for those computers or
what else?

One macros what doesn't work:
Sub MailIt()
' creates and sends a new e-mail message with Outlook
Dim OLF As Outlook.MAPIFolder, olMailItem As Outlook.MailItem
Dim cels, nosaukums, cels1, nosaukums1 As String
cels1 = ActiveWorkbook.fullname
nosaukums1 = ActiveWorkbook.Name
cels = Replace(cels1, " ", "%20")
nosaukums = Replace(nosaukums1, " ", "%20")
Set OLF = GetObject("", _

"Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
Set olMailItem = OLF.Items.Add ' creates a new e-mail message
With olMailItem
.Subject = nosaukums ' message subject
.Body = "file:///" & cels & Chr(13)
' the message text with a line break
.OriginatorDeliveryReportRequested = False ' delivery
confirmation
.ReadReceiptRequested = False ' read confirmation
'.Save ' saves the message for later editing
'.Send ' sends the e-mail message (puts it in the Outbox)
End With
olMailItem.Display
Set olMailItem = Nothing
Set OLF = Nothing

End Sub
 
D

Dave Peterson

My guess is that since you're using different versions of office and you have a
reference set to Outlook (a reference to a specific version of outlook at
that!), that this is the problem. You may want to use late binding to just use
the most current version that the user has.

You may want to look at these links that Tom Ogilvy posted recently:

Here are some more extensive references on binding:

Use late binding - don't have a reference to excel.

http://support.microsoft.com/default.aspx?scid=kb;EN-US;244167
INFO: Writing Automation Clients for Multiple Office Versions

http://support.microsoft.com/default.aspx?scid=kb;en-us;245115
INFO: Using Early Binding and Late Binding in Automation

http://support.microsoft.com/default.aspx?scid=kb;en-us;247579
INFO: Use DISPID Binding to Automate Office Applications Whenever Possible

and Dick Kusleika has a web page at:
http://www.dicks-clicks.com/excel/olBinding.htm
that explains this with Outlook
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top