| View previous topic :: View next topic |
| Author |
Message |
glenos Newbie

Joined: 02 Jan 2006 Posts: 1 Location: Tasmania, Australia
|
Posted: Mon Jan 02, 2006 4:40 pm Post subject: Migrating from Eexcel 97 - macro problems |
|
|
Hi,
I have just migrated from MSOffice 97 and have an excel macro that I use, but my programming is bad and I don't know how to get it to work in OOo.
I have pasted the code below.
It is supposed to;
stop the screen form updating, so it doesn't flicker
unprotect the sheet
hide the rows that do not containe a value in 'colum H
print the visible rows
unhide the rows
and protect the sheet.
When I first opened this to edit it, all the lines had been rem'd out, I have deleted the rem's
| Code: | Rem Attribute VBA_ModuleType=VBAModule
rem Sub Module1
Sub PrintActiveProducts()
'
' PrintActiveProducts Macro
' Macro recorded 9/07/04 by Glenos
'
Dim MyRow As Long
Dim LastRow As Long
'--------------------
Application.ScreenUpdating = False
ActiveSheet.Unprotect
MyRow = 1
LastRow = ActiveSheet.Range("A65536").End(xlUp).Row
'- hide rows
For MyRow = 1 To LastRow
If ActiveSheet.Cells(MyRow, 8).Value = "" Then
ActiveSheet.Rows(MyRow).EntireRow.Hidden = True
End If
Next
'- print
ActiveSheet.PrintOut
'- make rows visible
For MyRow = 1 To LastRow
ActiveSheet.Rows(MyRow).EntireRow.Hidden = False
Next
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Application.ScreenUpdating = True
End Sub |
It falls over at the line
| Code: | | Application.ScreenUpdating = False |
saying | Quote: | | object variable not set |
I hope this is not a question that gets asked everyday, I know how annoying that is.
Hope you can help me.
Cheers
Glenos |
|
| Back to top |
|
 |
marknelson OOo Enthusiast


Joined: 01 Oct 2005 Posts: 170 Location: Huntsville, Al
|
Posted: Mon Jan 02, 2006 5:13 pm Post subject: |
|
|
Visual BASIC will not work in OpenOffice and will be automatically rem'd out as you have noticed. But if you go to this thread: http://www.oooforum.org/forum/viewtopic.phtml?t=8833 it will take you to the Sticky on moving over from VBA to StarBasic which is the scripting language OpenOffice uses.  _________________ Retake The WEB
http://www.getfirefox.com |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
Posted: Wed Jan 04, 2006 12:49 am Post subject: |
|
|
Or you get yourself StarOffice 8 and let the conversion from VB to SB code be automated by an integrated tool.
Christian _________________ - Knowledge is Power - |
|
| Back to top |
|
 |
bankadmin Newbie

Joined: 03 Jun 2006 Posts: 4
|
Posted: Sat Jun 03, 2006 7:33 am Post subject: did you solve problem with : Application.ScreenUpdating = |
|
|
glenos -
did you solve problem with : Application.ScreenUpdating = False |
|
| Back to top |
|
 |
|