I'm trying to run a VBA / Excel program on 2 different pc's.
One is with the dutch version of Excel (VB 7) and one with the english one (VB 6.5).
When i try to run a function, i get the error:
Run-time error '32809':
Application-defined or object-defined error
When i strip down all code to just displaying a msgbox, the error still persists.
When i create a new tab, that tab can execute code.
I suppose this has something to do with wrong translation?
Any help on this?
Thanks!
Problem solved:
Store you excel file as .xls and not as .xlsm
Thanks team :)
Related
I have code that prints specific views to pdf using a specific fromDate and ToDate. My code started failing when I updated to ms Project 2016. Any ideas?
I've even tried removing the FromDate and ToDate and still get the error. When I add a watch to DocumentExport the Saveas dialog is displayed with the wrong filename, meaning the filename I am passing is not correct.
ViewApplyEx Name:="Gantt Employee", ApplyTo:=0 'view name
DocumentExport FileName:="C:\Schedules\test.pdf",FromDate:=printDate, ToDate:=printDateEnd
Run-time error '1004': Application-defined or object-defined error
Realized I didn't have the latest office 365 build due to being on the semi-annual update channel. I switched to the monthly channel updates and the problem was fixed.
I've posted the same question here
pyvot: can I run Excel VBA macros from python script?
I'm new to Python, so I do alot of searching.
Trying to Run a VBA project using snippets of Python code
Have encountered this error message, Win 7 based error I think.
Error message from PyScriptor reads as:
com_error:(-2147352567,'Exception occured',(0,"Microsoft \excel',
Excel cannot access 'MYFOLDERNAME,, The document may be read-only or
encrypted,", 'xlmain11.chm.,0,-2146827284),none)
Sorry about the forum errors, thought it was being helpfull, as I'm not taking the credit for this actual peiece of code.
import win32com.client
xl=win32com.client.Dispatch("Excel.Application")
xl.Workbooks.Open(Filename="C:\MYFOLDERNAME",ReadOnly=0)
xl.Application.Run("py_counter_test")
xl.Workbooks(1).Close(SaveChanges=1)
xl.Application.Quit()
xl=0
This the error I get, believe it's Win 7 issue.
I know I have not encrypted the folder, it is simply a "New Folder" in C:\
com_error:(-2147352567,'Exception occured',(0,"Microsoft \excel', Excel cannot access 'MYFOLDERNAME,, The document may be read-only or encrypted,", 'xlmain11.chm.,0,-2146827284),none)
Thanks
I saw the error,( over-sight ) left out the workbook name.
Amended code error.
import win32com.client
xl=win32com.client.Dispatch("Excel.Application")
xl.Workbooks.Open(Filename="C:\MYFOLDERNAME\PY-COUNTER.xlsm",ReadOnly=0)
xl.Application.Run("Macro1")
I've been having experiencing an issue with Word VBA where, if the Application is already open, it would just crash and doesn't do any further steps. I've been surfing the Net trying to figure this out, but no luck. The error appears at the o.Workbooks.Open line:
Dim o as Excel.Application
o.Workbooks.Open (ActiveDocument.Path + "\Data.xlsm")
Error message is
c:\fol\data.xlsm is already open or doesn't exist
It basically saves the data that was entered in Word text boxes. Note: All code afterwards works fine, this is the line where it breaks. I've tried using On Error that it would just stop, but it doesn't seem to work :/
Any ideas?
I have a VBA code that I used to use in an Excel 2016 (64-bit), and it works fine.
But when I tried to use in a Excel 2010 (32-bit) version, I've got an error "Runtime Error (1004) Application Defined or Object Defined Error" in the following line:
CndFrmtType = Sh.Cells.FormatConditions(CndFrmtItem).Type
I've already tried to re-build the file in a 2010 Excel (from the ground, to avoid reference's issues), but it still not working.
I really tried to google it, but didn't find anything about an eventual incompatibility in the FormatConditions object.
The returned FormatConditions object is as follows:
Can anyone help me on this?
be sure you have:
set Sh to a valid Worksheet object
initialized CndFrmtItem to a valid name or index number to reference a format condition of that worksheet
declared CndFrmtType as of Long type
and it'll work
I'm using the brazilian-portuguese version of Excel on a Windows 7 also pt-BR.
I have a spreadsheet that I use for months in the same machine, same excel version, same etc. and a vba code that worked until today. As far as I know I have changed nothing.
The code was: Range("tabReport[[#All],[Valor]]")
Today when i ran the macro it gave me an error: Run-time error '1004': Method 'Range' of object '_Global' failed
After several trial and error I corrected to: Range("tabReport[[#Tudo];[Valor]]")
Notes:
1) "Tudo" is "All" translated to pt-BR.
2) Comma "," became semicolon ";", the equivalent in pt-BR local syntax.
What bugs me is this change from nowhere, that could affect other workbooks.
Also I prefer mantain my macro in USA English (Global) syntax mode, so it's easier to google and mantain.
Anyone have a clue about how can I control this behavior?