PC Review


Reply
Thread Tools Rate Thread

Analyst tool Pack

 
 
Paulo
Guest
Posts: n/a
 
      13th Oct 2008
I have A macro that changes a formula in workbooks. It goes into a list,
opens the right WB and changes the formula, printout couple pages .

the problem Is evrey other that it opens , after the formual been printed
returns #VALUE!. Tha is because it could not calculate the WORKDAY function.
knowing that, I set the macro to make sure that it opens the ATPVBAEN.XLA
file.

but the pattern persists. every other file that my macro opens print out
#VALUE!.
does any one have any guess how to solv the problem.

Sub Imprimidor()

' On Error GoTo Fim

Dim x As Long
Dim Y As Long
Dim Formul As String
Dim Seq As Long
Dim Adit As String
Dim Clie As String
Dim Cam As String
Dim Cami As String
Dim Caminho As String
Dim Essa As String
Essa = Application.ActiveWindow.Caption
Y = Range("E1")
For x = Y To 27
Seq = Cells(x, "a").Value
Adit = Cells(x, "b").Value
Clie = Cells(x, "c").Value
Cam = "\\Servidor\dados\ADITIVOS\" & Clie & "\"
Cami = "(" & Seq & ") " & Clie & " ADITIVO " & Adit & " -TC- 1008 -
N.xls"
Caminho = Cam & Cami
Debug.Print Caminho
Workbooks.Open Caminho
ActiveWorkbook.UnprotectSharing
If ActiveWorkbook.MultiUserEditing Then ActiveWorkbook.ExclusiveAccess
'If ActiveWorkbook.ProtectStructure = True Then
Sheets(4).Unprotect "CECAPF"
Sheets(4).Range("C39").Formula = "=round((0.25*$c$24),2)"
Analyst:
Workbooks.Open(Filename:= _
"C:\Arquivos de programas\Microsoft
Office\OFFICE11\Bibliote\Analise\ATPVBAEN.XLA" _
).RunAutoMacros Which:=xlAutoOpen
Calculate
Workbooks(Cami).Activate
' If IsDate(Sheets("GERAL").Range("M15").Value) <> True Then GoTo Analyst
Debug.Print Application.ActiveWindow.Caption
Sheets("GERAL").Range("c2").Select
''IMPRIMINDO
Workbooks(Cami).Activate
Calculate
Sheets(4).PrintOut
MsgBox "Vire A página"
Worksheets("DETALHADA").PrintOut
Worksheets(1).Range("c2").Select
ActiveWorkbook.Close SaveChanges:=True
Workbooks(Essa).Activate
Sheets(1).Range("D" & x).Value = "ok"
Next
Fim:
'MsgBox "erro desconhecido: " & vbError
'Exit Sub

End Sub

thank you for the help
Paulo
 
Reply With Quote
 
 
 
 
Paulo
Guest
Posts: n/a
 
      13th Oct 2008
When I debug.print the cell that has value "VALUE!. " it returns "Erro 2015"
and @ the debug window,I get for every cell that has the WORKDAY function:
[GetMacroRegId] 'WORKDAY' <
[GetMacroRegId] Error while finding 'WORKDAY' >


"Paulo" wrote:

> I have A macro that changes a formula in workbooks. It goes into a list,
> opens the right WB and changes the formula, printout couple pages .
>
> the problem Is evrey other that it opens , after the formual been printed
> returns #VALUE!. Tha is because it could not calculate the WORKDAY function.
> knowing that, I set the macro to make sure that it opens the ATPVBAEN.XLA
> file.
>
> but the pattern persists. every other file that my macro opens print out
> #VALUE!.
> does any one have any guess how to solv the problem.
>
> Sub Imprimidor()
>
> ' On Error GoTo Fim
>
> Dim x As Long
> Dim Y As Long
> Dim Formul As String
> Dim Seq As Long
> Dim Adit As String
> Dim Clie As String
> Dim Cam As String
> Dim Cami As String
> Dim Caminho As String
> Dim Essa As String
> Essa = Application.ActiveWindow.Caption
> Y = Range("E1")
> For x = Y To 27
> Seq = Cells(x, "a").Value
> Adit = Cells(x, "b").Value
> Clie = Cells(x, "c").Value
> Cam = "\\Servidor\dados\ADITIVOS\" & Clie & "\"
> Cami = "(" & Seq & ") " & Clie & " ADITIVO " & Adit & " -TC- 1008 -
> N.xls"
> Caminho = Cam & Cami
> Debug.Print Caminho
> Workbooks.Open Caminho
> ActiveWorkbook.UnprotectSharing
> If ActiveWorkbook.MultiUserEditing Then ActiveWorkbook.ExclusiveAccess
> 'If ActiveWorkbook.ProtectStructure = True Then
> Sheets(4).Unprotect "CECAPF"
> Sheets(4).Range("C39").Formula = "=round((0.25*$c$24),2)"
> Analyst:
> Workbooks.Open(Filename:= _
> "C:\Arquivos de programas\Microsoft
> Office\OFFICE11\Bibliote\Analise\ATPVBAEN.XLA" _
> ).RunAutoMacros Which:=xlAutoOpen
> Calculate
> Workbooks(Cami).Activate
> ' If IsDate(Sheets("GERAL").Range("M15").Value) <> True Then GoTo Analyst
> Debug.Print Application.ActiveWindow.Caption
> Sheets("GERAL").Range("c2").Select
> ''IMPRIMINDO
> Workbooks(Cami).Activate
> Calculate
> Sheets(4).PrintOut
> MsgBox "Vire A página"
> Worksheets("DETALHADA").PrintOut
> Worksheets(1).Range("c2").Select
> ActiveWorkbook.Close SaveChanges:=True
> Workbooks(Essa).Activate
> Sheets(1).Range("D" & x).Value = "ok"
> Next
> Fim:
> 'MsgBox "erro desconhecido: " & vbError
> 'Exit Sub
>
> End Sub
>
> thank you for the help
> Paulo

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
ANALYST TOOL PACK --> #VALUE! Paulo Microsoft Excel Worksheet Functions 1 13th Oct 2008 10:55 PM
Analysis Tool Pack =?Utf-8?B?R2FyeSBU?= Microsoft Excel Crashes 2 31st Oct 2006 08:38 PM
anaysis tool pack =?Utf-8?B?RGFuIFBlcnJ5?= Microsoft Excel Misc 4 11th May 2005 04:17 PM
Information tool bar (Service Pack 2) Eric Windows XP Internet Explorer 5 1st Sep 2004 09:44 PM
Add ins - Analysis Tool Pack alex Microsoft Excel Setup 0 27th Feb 2004 12:00 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:27 AM.