Solved

Delete Excel Column From Access

Posted on 2013-10-28
11
474 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
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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

749 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