Hi everyone!
I have this code that simply opens a .xlsm file and then save it as .xls. The code is working fine, but sometimes at a very small chance, it's already been 10 minutes and the "conversion " is not yet finished, and just leaves an EXCEL.EXE instance on my task manager and a 1890A980.file on my target directory.
I would like to ask for an advice on how to handle this properly since this functionality...
User Profile
Collapse
-
asking for a VBS Handling advice
-
SaveAs taking too long.
Hi!
I have a code here that simply converts an xlsm file into a xls file. The code works fine (sometimes) but sometimes, it's not. It works fine by converting the xlsm file into a xls file for about less than a minute. But sometimes, it's already 5 minutes and the code is not yet finished (Assuming they're dealing with the same file). And when I looked at the target directory, I can see that there's a "43C4A100.f ile"... -
Problem solved!
For future reference on how to solve this issue programmaticall y, please refer to this link: http://bytes.com/topic/visual-basic/...using-vbscript
What I did is I created a VBA function on an excel template and then I called that function using vbscript and passed the parameter of the filepath + filename of the corrupted excel. -
Problem solved!
For future reference.
My VB script code:
Code:On Error Resume Next Dim ArgObj, var1, var2, var3 Set ArgObj = WScript.Arguments 'First parameter target file var1 = ArgObj(0) 'Second parameter validation file var2 = ArgObj(1) 'Third parameter macro var3 = ArgObj(2) Set objExcel1 = CreateObject("Excel.Application")
Leave a comment:
-
Pass a parameter to an excel function using vbscript
Hi,
I'm trying to pass a parameter to an VBA Excel function but I always got this error:
Type Mismatch error
This is my sample Excel function:
Code:Public Function OpenAndRepairWorkbook(X As String) As String Dim oWB As Workbook On Error GoTo Err_Open Application.DisplayAlerts = False Set oWB = Workbooks.Open(Filename:="D:\UnitTest.xlsm", CorruptLoad:=XlCorruptLoad.xlRepairFile)
-
irGed started a topic [Error] Excel found an unreadable content in ".xlsm" . Do you want to recover..?in Visual Basic[Error] Excel found an unreadable content in ".xlsm" . Do you want to recover..?
Hi,
I am getting an error saying,
Excel found an unreadable content in "****.xlsm" . Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes.
And when I clicked Yes, the workbook is back to normal again and when I saved it, the errors does not appear again. Question is, is there any way to solve this using VBScript? Thanks.
My code...Last edited by Niheel; Aug 22 '11, 02:01 AM. -
Update: fixed the EXCEL.EXE at windows task manager but the Run-time error message prompt is still there.
Code:On Error Resume Next Dim ArgObj, var1, var2, var3 Set ArgObj = WScript.Arguments 'First parameter target file var1 = ArgObj(0) 'Second parameter validation file var2 = ArgObj(1) 'Third parameter macro var3 = ArgObj(2) Set
Leave a comment:
-
[Error Handling] Run-time Error '9'
Hi,
I am trying to add an error handling functionality on my vbscript, but it doesnt seem working. My vbscript simply invokes an Excel Macro but there are some instance that the macro will produce a runtime error and when it happens, a message box prompts saying a Runtime error and then an "EXCEL.EXE" is running at my Windows Task Manager. I wanted to get rid of those two (EXCEL.EXE at task manager and Runtime error prompt... -
I have solved the problem but not sure if this is the best way to achieve this, if anyone has a better solution, please help me.
as for the code, I have exported the VB Component that contains the desired function and then I used a third-party tool to modify the generated export file and then I imported it with another excel.
for the export code:
Code:Dim ArgObj, inputExcel, outputFile Set ArgObj
Leave a comment:
-
just found out that creating macro on excel using vbscript is doable, just the copying of the "beforeSave " function left.Leave a comment:
-
VB Script that copies a VBA function
Hi,
I searched google to see if there's something that can help me achieve what I wanted to do, but couldn't find any. What I want to achieve is to write a VB script that can copy the code written on the "beforeSave " functionality. And then, writes a macro based on the content of the copied code.
Is this implementation possible?
Thanks. -
Hi,
I have already solved the invoke macro from another excel sheet. Thanks for the help.
For future reference, this is the code:
Code:Set objExcel1 = CreateObject("Excel.Application") Set objWorkbook1 = objExcel1.Workbooks.Open("C:\Validation.xlsm") Set objWorkbook2 = objExcel1.Workbooks.Open("C:\Original.xlsm") objExcel1.Run ("Validation.xlsm!ValidateExcel")
Leave a comment:
-
Hi,
I have a few codes here that I've tried but all of them failed.
Code:Set objExcel1 = CreateObject("Excel.Application") Set objWorkbook1 = objExcel1.Workbooks.Open("C:\Validation.xlsm") Set objExcel2 = CreateObject("Excel.Application") Set objWorkbook2 = objExcel2.Workbooks.Open("C:\Original.xlsm") objExcel1.Application.Run ("ValidateExcel")
Leave a comment:
-
Hi,
Thanks for all the help, although I paused for finding a solution for this problem because I got a task that has higher priority to finish. I think I would go for the second method, correct me if I'm wrong. First, I will write the macro on a separate excel ExcelB(an excel file that doesnt change no matter what), then since my main excel ExcelA file is always changing, I will invoke the macro on ExcelB that will affect ExcelA....Leave a comment:
-
Hi,
Thanks for the prompt reply. Yes, you are correct about the understanding of the question.Leave a comment:
-
Hi,
Thanks for the reply and all the help. And now, I have a separate question, should I start a new topic again or not?
The scenario is, I have a new excel now, but the difference with this excel file is I am not the one who generated/created this file, it comes from another source. And I want to perform a macro on it every time I ran a VB Script on it. If I just simply "hard-code" the macro on the...Leave a comment:
-
Hi,
Thanks for the reply but after reading your reply and knowing that invoking a Macro is by means of "Call" method, I have searched all the "Microsoft Excel Objects/Worksheet codes" for a word "Call" and found nothing. I don't know now if the Macro or just the VBA method is the one responsible for filling out some of the columns on my excel sheet. if it's just the VBA method, is there a method or keyword...Leave a comment:
-
Saving excel with VB
Hi,
I have a java code that populates data on my XLSM file, the problem is, the java code can't handle the execution of Macro, so what I'm just doing is to populate the excel file with java and then open the excel and save it manually and then the macro will be invoked.
I wanted to do it automatically, so I created a VB script that will open the file and will save it as well but the problem is, even though it saves and...
No activity results to display
Show More
Leave a comment: