Solved

Delete Excel Column From Access

Posted on 2013-10-28
11
481 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
[X]
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
  • 3
  • 2
  • 2
11 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

752 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