Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Delete Excel Column From Access

Posted on 2013-10-28
11
Medium Priority
?
510 Views
Last Modified: 2013-11-12
I need to delete an Excel column (P) from MS Access using VBA. Any thoughts. After deletion I need to save the WB and close Excel.
0
Comment
Question by:shieldsco
  • 3
  • 2
  • 2
7 Comments
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 39605423
Hi,

Sorry, but your requirement is not completely clear (to me).

How is column [P] within the MS-Excel workbook associated/linked with a column within an MS-Access database table?

Have you already opened a connection to the database &, hence, do you just need help with the code to remove a column from the MS-Access database schema (table definition)?

Thank you for your clarification & provision of all the relevant details to proceed.

BFN,

fp.
0
 

Author Comment

by:shieldsco
ID: 39605440
I'm using  Access and I want to delete an Excel column using Access VBA. If this helps, I'm using the following code to to convert two Excel columns to text using VBA from an Access button.

'Convert Columns A and B to Text
Private Sub Udate_Click()
 Set objApp = CreateObject("Excel.Application")
        objApp.Visible = False
        Set wb = objApp.Workbooks.Open("\\cdc\project\OD_FMO_DEBT_MGT\Cash Recon Database\General Fund FOIA.xlsx", True, False)
   
    wb.Sheets(1).Range("A:B").NumberFormat = "@"
    wb.Save
    wb.Close
  objApp.Quit
    Set objApp = Nothing
0
 

Author Comment

by:shieldsco
ID: 39605507
I figured it out -- thanks. Here is the code

Private Sub Command0_Click()
 Set objApp = CreateObject("Excel.Application")
        objApp.Visible = True
        Set wb = objApp.Workbooks.Open("\\cdc\project\OD_FMO_DEBT_MGT\Cash Recon Database\General Fund FOIA.xlsx", True, False)
   
    Columns("P:P").Delete

    wb.Save
    wb.Close
  objApp.Quit
    Set objApp = Nothing
   
End Sub
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 39605805
If you worked out a solution, then there should be no reason to accept my comment at all.

I have used the "Request Attention" link above to ask for the question to be re-opened, so your own comment can be accepted (& so you do not use any of your points on this question).
0
 
LVL 5

Expert Comment

by:Netminder
ID: 39631795
I've requested that this question be closed as follows:

Accepted answer: 0 points for shieldsco's comment #a39605507

for the following reason:

Starting closing process on behalf of Asker.

Netminder
Senior Admin
0
 

Author Comment

by:shieldsco
ID: 39628047
I figured it out -- thanks. Here is the code

Private Sub Command0_Click()
 Set objApp = CreateObject("Excel.Application")
        objApp.Visible = True
        Set wb = objApp.Workbooks.Open("\\cdc\project\OD_FMO_DEBT_MGT\Cash Recon Database\General Fund FOIA.xlsx", True, False)
   
    Columns("P:P").Delete

    wb.Save
    wb.Close
  objApp.Quit
    Set objApp = Nothing
   
End Sub
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 39631805
I have requested this question be closed and the solution be archived.

Netminder
Senior Admin
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

877 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