OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Migrating from Eexcel 97 - macro problems

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
glenos
Newbie
Newbie


Joined: 02 Jan 2006
Posts: 1
Location: Tasmania, Australia

PostPosted: Mon Jan 02, 2006 4:40 pm    Post subject: Migrating from Eexcel 97 - macro problems Reply with quote

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
View user's profile Send private message
marknelson
OOo Enthusiast
OOo Enthusiast


Joined: 01 Oct 2005
Posts: 176
Location: Huntsville, Al

PostPosted: Mon Jan 02, 2006 5:13 pm    Post subject: Reply with quote

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. Smile
_________________
Retake The WEB
http://www.getfirefox.com
Back to top
View user's profile Send private message Visit poster's website
Cybb20
Super User
Super User


Joined: 02 Mar 2004
Posts: 1569
Location: Frankfurt, Germany

PostPosted: Wed Jan 04, 2006 12:49 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
bankadmin
Newbie
Newbie


Joined: 03 Jun 2006
Posts: 4

PostPosted: Sat Jun 03, 2006 7:33 am    Post subject: did you solve problem with : Application.ScreenUpdating = Reply with quote

glenos -
did you solve problem with : Application.ScreenUpdating = False
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group