Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default Excel crashes if project is not compiled (urgent help please!)

Hi,


I wonder if it is possible to compile my project on startup.

The problem is, I protect my project with a password. If I switch from
Office XP to Office 2003, it crashes. The reason is, it only works if it is
compiled on the same excel version.

If I compile my project on XP, it works on XP. If I open the project on 2003
(without macro's enabled), I can see the Compile Project is Black (not
greyed out), so if I compile it on 2003, save it and close it, it works on
2003!

I tried with sendkeys to open the code, but I cannot accomplish to send the
password.

Can anyone help (is there a command in VBA that enforce a compilation on
startup?). I found this command vWB.VBProject.MakeCompiledFile but it does
not seem to work.

Thanks!
Jos Vens


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Excel crashes if project is not compiled (urgent help please!)

Compile code with code in VBE

Sub Compile()
Dim WB As Workbook
Set WB = Workbooks("Book1.xls")
With Application.VBE
.VBProjects(WB.VBProject.Name).VBComponents(1) _
.CodeModule.CodePane.Window.Visible = True
With .CommandBars.FindControl(Id:=578)
If .Enabled = True Then .Execute
End With
End With
End Sub

I don't think this will work if the project is protected, because you
couldn't make the code pane visible.


--
Regards,
Tom Ogilvy



"Jos Vens" wrote:

Hi,


I wonder if it is possible to compile my project on startup.

The problem is, I protect my project with a password. If I switch from
Office XP to Office 2003, it crashes. The reason is, it only works if it is
compiled on the same excel version.

If I compile my project on XP, it works on XP. If I open the project on 2003
(without macro's enabled), I can see the Compile Project is Black (not
greyed out), so if I compile it on 2003, save it and close it, it works on
2003!

I tried with sendkeys to open the code, but I cannot accomplish to send the
password.

Can anyone help (is there a command in VBA that enforce a compilation on
startup?). I found this command vWB.VBProject.MakeCompiledFile but it does
not seem to work.

Thanks!
Jos Vens



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default Excel crashes if project is not compiled (urgent help please!)

Thanks Tom,

but it is right: it only works if I don't protect it!

Is there a way to unprotect it procedurally? Can I provide the password with
sendkeys? For me, Excel blocks the input (procedure that is running) when
the dialog is asking the password so sendkeys does not make sense.
Jos

"Tom Ogilvy" schreef in bericht
...
Compile code with code in VBE

Sub Compile()
Dim WB As Workbook
Set WB = Workbooks("Book1.xls")
With Application.VBE
.VBProjects(WB.VBProject.Name).VBComponents(1) _
.CodeModule.CodePane.Window.Visible = True
With .CommandBars.FindControl(Id:=578)
If .Enabled = True Then .Execute
End With
End With
End Sub

I don't think this will work if the project is protected, because you
couldn't make the code pane visible.


--
Regards,
Tom Ogilvy



"Jos Vens" wrote:

Hi,


I wonder if it is possible to compile my project on startup.

The problem is, I protect my project with a password. If I switch from
Office XP to Office 2003, it crashes. The reason is, it only works if it
is
compiled on the same excel version.

If I compile my project on XP, it works on XP. If I open the project on
2003
(without macro's enabled), I can see the Compile Project is Black (not
greyed out), so if I compile it on 2003, save it and close it, it works
on
2003!

I tried with sendkeys to open the code, but I cannot accomplish to send
the
password.

Can anyone help (is there a command in VBA that enforce a compilation on
startup?). I found this command vWB.VBProject.MakeCompiledFile but it
does
not seem to work.

Thanks!
Jos Vens





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default Excel crashes if project is not compiled (urgent help please!)

Hi Tom,

this code works! I provide a password but don't put the checkbox on (so I
can see the codepane. After compiling, I set the checkbox, save and close.
If I could now accomplish to open the project in the same manner, I get what
I want. What keys should I sent to let appear the password dialog for the
project of a xla-file of the list (if it is not the first in the list).

Thanks
Jos

Function COMPILE_Psw()

Dim vWB As Workbook

Set vWB = Workbooks("Psw.xla")

Application.VBE.VBProjects(vWB.VBProject.Name).VBC omponents(1).CodeModule.CodePane.Window.Visible
= True
If Application.VBE.CommandBars.FindControl(ID:=578).E nabled = True Then
Application.VBE.CommandBars.FindControl(ID:=578).E xecute
End If

Application.SendKeys "%xe+{TAB}{RIGHT}{TAB}v{TAB}{TAB}{TAB}~"

vWB.Save
vWB.Close

End Function





"Jos Vens" schreef in bericht
...
Thanks Tom,

but it is right: it only works if I don't protect it!

Is there a way to unprotect it procedurally? Can I provide the password
with sendkeys? For me, Excel blocks the input (procedure that is running)
when the dialog is asking the password so sendkeys does not make sense.
Jos

"Tom Ogilvy" schreef in bericht
...
Compile code with code in VBE

Sub Compile()
Dim WB As Workbook
Set WB = Workbooks("Book1.xls")
With Application.VBE
.VBProjects(WB.VBProject.Name).VBComponents(1) _
.CodeModule.CodePane.Window.Visible = True
With .CommandBars.FindControl(Id:=578)
If .Enabled = True Then .Execute
End With
End With
End Sub

I don't think this will work if the project is protected, because you
couldn't make the code pane visible.


--
Regards,
Tom Ogilvy



"Jos Vens" wrote:

Hi,


I wonder if it is possible to compile my project on startup.

The problem is, I protect my project with a password. If I switch from
Office XP to Office 2003, it crashes. The reason is, it only works if it
is
compiled on the same excel version.

If I compile my project on XP, it works on XP. If I open the project on
2003
(without macro's enabled), I can see the Compile Project is Black (not
greyed out), so if I compile it on 2003, save it and close it, it works
on
2003!

I tried with sendkeys to open the code, but I cannot accomplish to send
the
password.

Can anyone help (is there a command in VBA that enforce a compilation on
startup?). I found this command vWB.VBProject.MakeCompiledFile but it
does
not seem to work.

Thanks!
Jos Vens







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Excel crashes if project is not compiled (urgent help please!)

I don't know. but, some others have posted code for sendkeys to send the
password to the VBE project. Search this group in http://groups.google.com

It seems if you have to do all this and it isn't really supported, that you
shouldn't need to - that you have a more systemic problem

--
Regards,
Tom Ogilvy


"Jos Vens" wrote:

Hi Tom,

this code works! I provide a password but don't put the checkbox on (so I
can see the codepane. After compiling, I set the checkbox, save and close.
If I could now accomplish to open the project in the same manner, I get what
I want. What keys should I sent to let appear the password dialog for the
project of a xla-file of the list (if it is not the first in the list).

Thanks
Jos

Function COMPILE_Psw()

Dim vWB As Workbook

Set vWB = Workbooks("Psw.xla")

Application.VBE.VBProjects(vWB.VBProject.Name).VBC omponents(1).CodeModule.CodePane.Window.Visible
= True
If Application.VBE.CommandBars.FindControl(ID:=578).E nabled = True Then
Application.VBE.CommandBars.FindControl(ID:=578).E xecute
End If

Application.SendKeys "%xe+{TAB}{RIGHT}{TAB}v{TAB}{TAB}{TAB}~"

vWB.Save
vWB.Close

End Function





"Jos Vens" schreef in bericht
...
Thanks Tom,

but it is right: it only works if I don't protect it!

Is there a way to unprotect it procedurally? Can I provide the password
with sendkeys? For me, Excel blocks the input (procedure that is running)
when the dialog is asking the password so sendkeys does not make sense.
Jos

"Tom Ogilvy" schreef in bericht
...
Compile code with code in VBE

Sub Compile()
Dim WB As Workbook
Set WB = Workbooks("Book1.xls")
With Application.VBE
.VBProjects(WB.VBProject.Name).VBComponents(1) _
.CodeModule.CodePane.Window.Visible = True
With .CommandBars.FindControl(Id:=578)
If .Enabled = True Then .Execute
End With
End With
End Sub

I don't think this will work if the project is protected, because you
couldn't make the code pane visible.


--
Regards,
Tom Ogilvy



"Jos Vens" wrote:

Hi,


I wonder if it is possible to compile my project on startup.

The problem is, I protect my project with a password. If I switch from
Office XP to Office 2003, it crashes. The reason is, it only works if it
is
compiled on the same excel version.

If I compile my project on XP, it works on XP. If I open the project on
2003
(without macro's enabled), I can see the Compile Project is Black (not
greyed out), so if I compile it on 2003, save it and close it, it works
on
2003!

I tried with sendkeys to open the code, but I cannot accomplish to send
the
password.

Can anyone help (is there a command in VBA that enforce a compilation on
startup?). I found this command vWB.VBProject.MakeCompiledFile but it
does
not seem to work.

Thanks!
Jos Vens








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
Please help -- URGENT -- need to resolve the issue before submittingmy project sunny123 Excel Discussion (Misc queries) 0 May 27th 09 05:14 PM
Time calculation problem (URGENTProject due) g6pack Excel Discussion (Misc queries) 4 November 28th 05 04:14 AM
Compiled Excel macros Tomasz Klim Excel Discussion (Misc queries) 4 October 26th 05 11:46 AM
With VBA from Excel: Open Project, extract resource list and copy it to a worksheet, close project. Tony Excel Programming 1 October 18th 05 03:53 PM
call VBA compiled code within vba Les[_5_] Excel Programming 1 September 26th 03 06:27 PM


All times are GMT +1. The time now is 10:54 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"