Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Prevent Group display

Posted on 2012-03-13
6
181 Views
Last Modified: 2012-03-14
I need Experts advice. Is a way for us not to display the vertical group (+) option when I export the attached workbook by using the "Sub moveDifFolder" module?
RemoveGroup.xls
0
Comment
Question by:Billa7
  • 3
  • 3
6 Comments
 
LVL 42

Expert Comment

by:dlmille
ID: 37718298
Just add the .Rows.Ungroup method to your worksheet.

Option Explicit

Sub moveDifFolder()
Dim wkb As Workbook
Dim newWkb As Workbook
Dim wks As Worksheet
Dim oPic As Object
Dim sPath As String
Dim fName As String
Dim fPathName As String

    Set wkb = ThisWorkbook
    sPath = "C:\temp"
    With wkb.Worksheets("Data")
    Range("AT2") = "_Issued on " & Format(Now, "mm.dd.yyyy"" @ ""hhmm")
        fName = .Range("AW1") & .Range("AV1")
        .Rows.Ungroup
    End With
    
    fPathName = sPath & "\" & fName
    
    Application.DisplayAlerts = False
    
    wkb.Sheets.Copy
    
    Set newWkb = ActiveWorkbook
    
    'delete pictures
    For Each wks In newWkb.Worksheets
        For Each oPic In wks.Pictures
            oPic.Delete
        Next oPic
    Next wks
            
    'clear K:Q in Data sheet
    Set wks = newWkb.Worksheets("Data")
    'wks.Range("K:Q").Clear
    
    'Call RemoveAllMacros(newWkb)
    'Save the workbook
    
    newWkb.SaveAs Filename:=fPathName & ".xls", FileFormat:=xlExcel8
    newWkb.Close
    
    
    MsgBox "Process Complete!"
End Sub

Open in new window

0
 
LVL 42

Expert Comment

by:dlmille
ID: 37718301
So, for row group removal:

Wks.Rows.Ungroup

and for column group removal:

Wks.Columns.Ungroup

Cheers,

Dave
0
 

Author Comment

by:Billa7
ID: 37718602
Hi Dave,

The group removal need to be done at export file, not the source. Please assist.
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:Billa7
ID: 37719290
Hi Dave,

I have tried to copy "Wks.Rows.Ungroup" at exported wb but it shows as:

Invalid or unqualified reference.


Here's the line that I've tested:

Next wks
           
    'clear K:Q in Data sheet
    Set wks = newWkb.Worksheets("Data")
    .Rows.Ungroup
    'wks.Range("K:Q").Clear
0
 
LVL 42

Accepted Solution

by:
dlmille earned 500 total points
ID: 37720905
The wks.  in my example is just the variable that holds the worksheet object where you want to make the change.

You were close, but need to reference the wks object in your statement (in the previous post, you were doing a With, so I used .Rows.Ungroup.  In this instance, we can just reference the worksheet object directly (and we could have, in the prior post, as well).

Here's your modified code (See added line 36):
Option Explicit

Sub moveDifFolder()
Dim wkb As Workbook
Dim newWkb As Workbook
Dim wks As Worksheet
Dim oPic As Object
Dim sPath As String
Dim fName As String
Dim fPathName As String

    Set wkb = ThisWorkbook
    sPath = "C:\temp"
    With wkb.Worksheets("Data")
    Range("AT2") = "_Issued on " & Format(Now, "mm.dd.yyyy"" @ ""hhmm")
        fName = .Range("AW1") & .Range("AV1")
    End With
    
    fPathName = sPath & "\" & fName
    
    Application.DisplayAlerts = False
    
    wkb.Sheets.Copy
    
    Set newWkb = ActiveWorkbook
    
    'delete pictures
    For Each wks In newWkb.Worksheets
        For Each oPic In wks.Pictures
            oPic.Delete
        Next oPic
    Next wks
            
    'clear K:Q in Data sheet
    Set wks = newWkb.Worksheets("Data")
    wks.Rows.Ungroup
    'wks.Range("K:Q").Clear
    
    'Call RemoveAllMacros(newWkb)
    'Save the workbook
    
    newWkb.SaveAs Filename:=fPathName & ".xls", FileFormat:=xlExcel8
    newWkb.Close
    
    
    MsgBox "Process Complete!"
End Sub

Open in new window


Dave
0
 

Author Closing Comment

by:Billa7
ID: 37723145
Thanks a lot Dave
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to reset cell styles? 15 25
Excel 2007 Macro to Change Column Formatting 3 33
populate  some cells after data verification 45 25
Strategy Mapping Excel WB/WS 2 26
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question